1. Home
  2. Samba
  3. Extra
  4. Export Customer Subscription Status via API
  1. Home
  2. Samba
  3. Extra
  4. Samba API
  5. Export Customer Subscription Status via API

Export Customer Subscription Status via API

Contents
With this API, you can sync the customer subscription status to a newsletter in Samba with your system. You can retrieve the entire list or just the changes (only the customers who have changed the subscription level of the newsletter in the interval <from, now>). You can also choose whether you only require subscribed or unsubscribed customers. The data provided in the request response are updated with respect to the last data synchronization in Samba. All customers in Samba are included – from the customers feed, imported customers, and collected subscribers from popups.

GET

https://api.samba.ai/shop/sambaId/subscriptions?from=YYYY-MM-DD&state=subscription_state
header: X-Api-Key: your-api-key
  • sambaId – Samba ID of your e-shop
  • your-api-key – Samba API key for your e-shop
  • from – [optional] the date in YYYY-MM-DD format (time is set to 00:00). If this parameter is omitted, the entire history will be exported.
  • state – [optional] select from “subscribed” or “unsubscribed”. If you omit this parameter, all login states will be exported.

RESPONSE

JSON format – stream, one json object per line (application/json-seq):

{"customerId":"XYZ123", //ID of Customer
  "email":"xyz123@samba.ai", // Customer's email address
  "newsletterFrequency":"every day", //Customer's current subscription preferences: "every day"/"special occasions" = subscribed, "never" = unsubscribed
  "since":1526481188957 //time (in milliseconds) since subscribing
}

EXAMPLE

curl -H 'X-Api-Key: key' 'https://api.samba.ai/shop/4541245641234564/subscriptions?from=2018-04-19'
{"customerId":"XYZ123","email":"xyz123@samba.ai","newsletterFrequency":"every day","since":1526481188957}
{"customerId":"ABC123","email":"abc123@samba.ai","newsletterFrequency":"never","since":1526481188957}
{"customerId":"XAZ1R3","email":"xaz1r3@samba.ai","newsletterFrequency":"every day","since":1526481188957}
curl -H 'X-Api-Key: key' 'https://api.samba.ai/shop/4541245641234564/subscriptions?from=2018-04-19&state=subscribed'
{"customerId":"XYZ123","email":"xyz123@samba.ai","newsletterFrequency":"every day","since":1526481188957}
{"customerId":"XAZ1R3","email":"xaz1r3@samba.ai","newsletterFrequency":"every day","since":1526481188957}

Based on your account it might be required to use “https://api.yottly.com” as an endpoint. For further info please contact our support.

This post is also available in: Čeština (Czech)

Updated on March 19, 2021

Was this article helpful?

Related Articles