Showing results for 
Search instead for 
Did you mean: 

Rest API for querying and updating Newsletter Subscribers missing

Rest API for querying and updating Newsletter Subscribers missing

Feature request from fvschie, posted on GitHub Apr 05, 2016

There is no API for getting or setting newsletter subscription status. Such an API is necessary for integration with third-party systems, specifically mailing platforms.

This needs to be separate from customer API of course, although adding newsletter subscription status to Customers would be a welcome addition too.

Not applicable

Comment from piotrekkaminski, posted on GitHub Jun 09, 2016

@choukalos feature request for you

Not applicable

Comment from qwerty7869, posted on GitHub Jun 16, 2016

Did anyone had created newsletter rest api?

Not applicable

Comment from fvschie, posted on GitHub Aug 04, 2016

Hi, what's the status on this story?

Regular Visitor

seems like this is a pretty big gap in the API. is there any indication from the core team on whether this is being worked on @piotrekkaminski ?

Magento Team

Hi all, 
you can currently subscribe/unsubscribe customers to the newsletter via the Customer resource. You PUT something like the following, specifying the extension_attribute is_subscribed:

    "id": 2,
    "group_id": 1,
    "default_billing": "0",
    "default_shipping": "0",
    "created_at": "2017-01-10 16:32:32",
    "updated_at": "2017-01-27 15:27:33",
    "created_in": "Default Store View",
    "email": "",
    "firstname": "FirstName",
    "lastname": "LastName",
    "store_id": 1,
    "website_id": 1,
    "addresses": [],
    "disable_auto_group_change": 0,
    "extension_attributes": {
      "is_subscribed": true

There's an issue currently reading this extension attribute on GET. The problem is that the plugin for the Customer module does not express how to populate this newsletter extension attribute data on a GET of a customer resource, hence it's missing from the response. The missing function needs to be defined here:

<magento dir>/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php


Senior Member

Why doesn't a GET on /v1/customers/{id} return the extension attributes { is_subscribed } ?

Magento Team

The reason is that the bottom of my previous response. This issue is internally tracked under ticket MAGETWO-71829, but can be worked around as stated above.