cancel
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.

8 Comments
apiuser
New Member

Comment from piotrekkaminski, posted on GitHub Jun 09, 2016

@choukalos feature request for you

apiuser
New Member

Comment from qwerty7869, posted on GitHub Jun 16, 2016

Did anyone had created newsletter rest api?

apiuser
New Member

Comment from fvschie, posted on GitHub Aug 04, 2016

Hi, what's the status on this story?

jonpday
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 ?

mkotov
Adobe 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:

{"customer": 
  {
    "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": "customer@example.com",
    "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

 

lance007
Senior Member

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

mkotov
Adobe 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. 

combinatoria
New Member

Hello there,

 

I'd like to follow up on the original request, which was made for the API to support subscribers.

 

I understand that the workaround added by @mkotov refers to subscribe/ubsubscribe existing customers. In our case, we'd like subscribe/unsubscribe emails that may not be related to existing customers. For that case, it would be preferable to have an endpoint that supports basic CRUD operations with subscribers.

 

Are there any plans to include these features as part of the roadmap?

 

Thanks in advance,

Mat