Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
ImpliedContentType: 
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.

new Http http;
ckbool success;

new JsonObject queryParams;
ignore = queryParams.UpdateString("subscription_group_id","{{subscription_group_id}}");
ignore = queryParams.UpdateString("external_id","{{external_identifier}}");
ignore = queryParams.UpdateString("phone"," 11112223333");

// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}";


HttpResponse resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",queryParams);
if (http.LastMethodSuccess == ckfalse) {
    println http.LastErrorText;
    return;
}

println resp.StatusCode;
println resp.BodyStr;
delete resp;

---- end chilkat script ----

Powershell / Braze Endpoints / List User's Subscription Group Status - SMS

Back to Collection Items

Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = New-Object Chilkat.Http

$queryParams = New-Object Chilkat.JsonObject
$queryParams.UpdateString("subscription_group_id","{{subscription_group_id}}")
$queryParams.UpdateString("external_id","{{external_identifier}}")
$queryParams.UpdateString("phone"," 11112223333")

# Adds the "Authorization: Bearer {{api_key}}" header.
ERROR: Property not found: Http.AuthToken
Assignment type mismatch.  ExpressionType=string, atgType=ERROR:

ERROR: Entry not found: Http.QuickRequestParams
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: JsonObject
    varName: queryParams
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

ERROR: Non-existent Chilkat method:  Http.QuickRequestParams
$resp = $http.QuickRequestParams("GET","https://rest.iad-01.braze.com/subscription/status/get",$queryParams)
ERROR: Entry not found: Http.LastMethodSuccess
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: JsonObject
    varName: queryParams
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

if ($http.LastMethodSuccess -eq $false) {
ERROR: Entry not found: Http.LastErrorText
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: JsonObject
    varName: queryParams
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

    $($http.LastErrorText)
    exit
}

$($resp.StatusCode)
$($resp.BodyStr)

Curl Command

curl -G -d "subscription_group_id=%7B%7Bsubscription_group_id%7D%7D"
	-d "external_id=%7B%7Bexternal_identifier%7D%7D"
	-d "phone=%2011112223333"
	-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 - SMS",
  "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}}&phone=+11112223333",
      "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 phone is accepted for SMS subscription groups\n"
        },
        {
          "key": "phone",
          "value": "+11112223333",
          "description": "(Required*) String\n\nThe phone number of the user (must include at least one phone number and at most 50 phone numbers). The recommendation is to provide this in the E.164 format.\n\nOnly external_id or phone is accepted for SMS subscription groups\n"
        }
      ]
    },
    "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": [
  ]
}