SQL Server / Braze Endpoints / List User's Subscription Group - SMS
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'external_id', '{{external_id}}'
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'limit', 100
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'offset', 1
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'phone', ' 11112223333'
-- Adds the "Authorization: Bearer {{api_key}}" header.
EXEC sp_OASetProperty @http, 'AuthToken', '{{api_key}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://rest.iad-01.braze.com/subscription/user/status', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
Curl Command
curl -G -d "external_id=%7B%7Bexternal_id%7D%7D"
-d "limit=100"
-d "offset=1"
-d "phone=%2011112223333"
-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/subscription/user/status
Postman Collection Item JSON
{
"name": "List User's Subscription Group - SMS",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{api_key}}",
"type": "text"
}
],
"url": {
"raw": "https://{{instance_url}}/subscription/user/status?external_id={{external_id}}&limit=100&offset=1&phone=+11112223333",
"protocol": "https",
"host": [
"{{instance_url}}"
],
"path": [
"subscription",
"user",
"status"
],
"query": [
{
"key": "external_id",
"value": "{{external_id}}",
"description": "(Required*) String\n\nThe external_id of the user. Must include at least one and at most 50 `external_ids`."
},
{
"key": "limit",
"value": "100",
"description": "(Optional) Integer\n\nThe limit on the maximum number of results returned. Default (and max) limit is 100."
},
{
"key": "offset",
"value": "1",
"description": "(Optional) Integer\n\nNumber of templates to skip before returning rest of the templates that fit the search criteria."
},
{
"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"
}
]
},
"description": "Use the endpoint below to list and get the subscription groups of a certain user.\n\n> If there are multiple users (multiple external ids) who share the same email address, all users will be returned as a separate user (even if they have the same email address or subscription group)."
},
"response": [
]
}