Chilkat Online Tools

PowerBuilder / Braze Endpoints / Update Scheduled API Triggered Canvases

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "canvas_id": "canvas_identifier",
//   "schedule_id": "schedule_identifier",
//   "schedule": {
//     "time": "2017-05-24T21:30:00Z",
//     "in_local_time": true
//   }
// }

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.UpdateString("canvas_id","canvas_identifier")
loo_Json.UpdateString("schedule_id","schedule_identifier")
loo_Json.UpdateString("schedule.time","2017-05-24T21:30:00Z")
loo_Json.UpdateBool("schedule.in_local_time",1)

loo_Http.SetRequestHeader("Content-Type","application/json")
// Adds the "Authorization: Bearer {{api_key}}" header.
loo_Http.AuthToken = "{{api_key}}"

loo_Resp = loo_Http.PostJson3("https://rest.iad-01.braze.com/canvas/trigger/schedule/update","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    return
end if

Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp


destroy loo_Http
destroy loo_Json

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{api_key}}"
	-d '{
  "canvas_id": "canvas_identifier",
  "schedule_id": "schedule_identifier",
  "schedule": {
    "time": "2017-05-24T21:30:00Z",
    "in_local_time": true
  }
}'
https://rest.iad-01.braze.com/canvas/trigger/schedule/update

Postman Collection Item JSON

{
  "name": "Update Scheduled API Triggered Canvases",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{api_key}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"canvas_id\": \"canvas_identifier\",\n  \"schedule_id\": \"schedule_identifier\",\n  \"schedule\": {\n    \"time\": \"2017-05-24T21:30:00Z\",\n    \"in_local_time\": true\n  }\n}"
    },
    "url": {
      "raw": "https://{{instance_url}}/canvas/trigger/schedule/update",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "canvas",
        "trigger",
        "schedule",
        "update"
      ]
    },
    "description": "Use this endpoint to update scheduled API Triggered Canvases, which are created on the Dashboard and initiated via the API. You can pass in `trigger_properties` that will be templated into the message itself.\n\nThis endpoint allows you to update scheduled Canvas messages via API Triggered delivery, allowing you to decide what action should trigger the message to be sent. Please note that to send messages with this endpoint, you must have a Canvas ID, created when you build a Canvas.\n\nAny schedule will completely overwrite the one that you provided in the create schedule request or in previous update schedule requests. For example, if you originally provide `\"schedule\" : {\"time\" : \"2015-02-20T13:14:47\", \"in_local_time\" : true}` and then in your update you provide `\"schedule\" : {\"time\" : \"2015-02-20T14:14:47\"}`, your message will now be sent at the provided time in UTC, not in the user's local time. Scheduled triggers that are updated very close to or during the time they were supposed to be sent will be updated with best efforts, so last-second changes could be applied to all, some, or none of your targeted users.\n\n### Request Parameters\n| Parameter | Required | Data Type | Description |\n| --------- | ---------| --------- | ----------- |\n|`canvas_id`|Required|String| See canvas identifier|\n|`schedule_id`| Optional | String | The schedule_id to update (obtained from the response to create schedule) |\n|`schedule` | Required | Object | See schedule object |\n\n## Request Components\n\n- [Canvas ID](https://www.braze.com/docs/api/identifier_types/)\n- [Schedule Object](https://www.braze.com/docs/api/objects_filters/schedule_object/)"
  },
  "response": [
  ]
}