SQL Server / Braze Endpoints / Get Upcoming Scheduled Campaigns and Canvases
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, 'end_time', '2018-09-01T00:00:00-04:00'
-- 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/messages/scheduled_broadcasts', @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 "end_time=2018-09-01T00%3A00%3A00-04%3A00"
-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/messages/scheduled_broadcasts
Postman Collection Item JSON
{
"name": "Get Upcoming Scheduled Campaigns and Canvases",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{api_key}}",
"type": "text"
}
],
"url": {
"raw": "https://{{instance_url}}/messages/scheduled_broadcasts?end_time=2018-09-01T00:00:00-04:00",
"protocol": "https",
"host": [
"{{instance_url}}"
],
"path": [
"messages",
"scheduled_broadcasts"
],
"query": [
{
"key": "end_time",
"value": "2018-09-01T00:00:00-04:00",
"description": "(Required) String in ISO 8601 format\n\nEnd date of the range to retrieve upcoming scheduled Campaigns and Canvases. This is treated as midnight in UTC time by the API."
}
]
},
"description": "You can view a JSON list of upcoming and scheduled Campaigns and Canvases using the following information and parameters. The endpoint will return information about scheduled Campaigns and entry Canvases between now and the designated end_time (ISO 8601 format) specified in the request. Daily, recurring messages will only appear once with their next occurrence. Results returned in this endpoint are only for Campaigns and Canvases created and scheduled in Braze.\n\n## Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n \"scheduled_broadcasts\": [\n # Example Canvas\n {\n \"name\" => String,\n \"id\" => String,\n \"type\" => \"Canvas\",\n \"tags\" => [String tag names],\n \"next_send_time\" => \"YYYY-MM-DD HH:mm:ss\" (may also include time zone if not local/intelligent delivery)\n \"schedule_type\" => one of \"local_time_zones\", \"intelligent_delivery\", or the name of your company's time zone\n },\n # Example Campaign\n {\n \"name\" => String,\n \"id\" => String,\n \"type\" => \"Campaign\",\n \"tags\" => [String tag names],\n \"next_send_time\" => \"YYYY-MM-DD HH:mm:ss\" (may also include time zone if not local/intelligent delivery)\n \"schedule_type\" => one of \"local_time_zones\", \"intelligent_delivery\", or the name of your company's time zone\n },\n ]\n}\n```"
},
"response": [
]
}