Swift / Braze Endpoints / List User's Subscription Group Status - Email
Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()
var success: Bool
let queryParams = CkoJsonObject()
queryParams.UpdateString("subscription_group_id", value: "{{subscription_group_id}}")
queryParams.UpdateString("external_id", value: "{{external_identifier}}")
queryParams.UpdateString("email", value: "example@braze.com")
// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}"
var resp: CkoHttpResponse? = http.QuickRequestParams("GET", url: "https://rest.iad-01.braze.com/subscription/status/get", json: queryParams)
if http.LastMethodSuccess == false {
print("\(http.LastErrorText)")
return
}
print("\(resp!.StatusCode.intValue)")
print("\(resp!.BodyStr)")
resp = nil
}
Curl Command
curl -G -d "subscription_group_id=%7B%7Bsubscription_group_id%7D%7D"
-d "external_id=%7B%7Bexternal_identifier%7D%7D"
-d "email=example%40braze.com"
-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/subscription/status/get
Postman Collection Item JSON
{
"name": "List User's Subscription Group Status - Email",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{api_key}}",
"type": "text"
}
],
"url": {
"raw": "https://{{instance_url}}/subscription/status/get?subscription_group_id={{subscription_group_id}}&external_id={{external_identifier}}&email=example@braze.com",
"protocol": "https",
"host": [
"{{instance_url}}"
],
"path": [
"subscription",
"status",
"get"
],
"query": [
{
"key": "subscription_group_id",
"value": "{{subscription_group_id}}",
"description": "(Required) String\n\nThe `id` of your subscription group."
},
{
"key": "external_id",
"value": "{{external_identifier}}",
"description": "(Required*) String\n\nThe `external_id` of the user (must include at least one and at most 50 `external_ids`).\n\nOnly external_id or email is accepted for email subscription groups"
},
{
"key": "email",
"value": "example@braze.com",
"description": "(Required* ) String\n\nThe email address of the user. Can be passed as an array of string with a max of 50.\n\nOnly external_id or email is accepted for email subscription groups"
}
]
},
"description": "Use the endpoint below to get the subscription state of a user in a subscription group. The response from this endpoint will include the external ID and either subscribed, unsubscribed, or unknown for the specific subscription group requested in the API call. This can be used to update the subscription group state in subsequent API calls or to be displayed on a hosted web page.\n\n> *Either `external_id` or `email` are required.\n\n## Response\n\nAll successful responses will return `subscribed`, `unsubscribed`, or `unknown` depending on status and user history with the subscription group.\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n \"status\": {\n \"1\": \"Unsubscribed\",\n \"2\": \"Subscribed\"\n },\n \"message\": \"success\"\n}\n```"
},
"response": [
]
}