I believe you can't set is_subscribed
by the customer API because what determines if a customer is subscribed to the newsletter is actually determined by the \Magento\Newsletter\Model\Subscriber
Model. So if you want to do this via api you'll need to create a custom API call to do such. Here's a quick module I threw together for you.
Create a new module
<Vendor>_Newsletter
Create module.xml file
app/code/<Vendor>/Newsletter/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Newsletter" setup_version="1.0.0">
<sequence>
<module name="Magento_Newsletter" />
</sequence>
</module>
</config>
Create webapi.xml file
app/code/<Vendor>/Newsletter/etc/webapi.xml
<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/newsletter/subscribe/:email" method="GET">
<service class="Magento\Newsletter\Model\Subscriber" method="subscribe"/>
<resources>
<resource ref="Magento_Newsletter::subscriber"/>
</resources>
</route>
</routes>
Now you should be able to subscribe a customer by simply making a API GET
request to https://your_magento_store.com/rest/V1/newsletter/subscribe/[email protected]
. This will call \Magento\Newsletter\Model\Subscriber::subscribe
and pass in the email provided in the request uri as the parameter to the function.