Chilkat Online Tools

VBScript / Braze Endpoints / Campaign List

Back to Collection Items

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

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

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = CreateObject("Chilkat.Http")

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set queryParams = CreateObject("Chilkat.JsonObject")
success = queryParams.UpdateInt("page",0)
success = queryParams.UpdateString("include_archived","false")
success = queryParams.UpdateString("sort_direction","desc")
success = queryParams.UpdateString("last_edit.time[gt]","2020-06-28T23:59:59-5:00")

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

' resp is a Chilkat.HttpResponse
Set resp = http.QuickRequestParams("GET","https://rest.iad-01.braze.com/campaigns/list",queryParams)
If (http.LastMethodSuccess = 0) Then
    outFile.WriteLine(http.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine(resp.StatusCode)
outFile.WriteLine(resp.BodyStr)


outFile.Close

Curl Command

curl -G -d "page=0"
	-d "include_archived=false"
	-d "sort_direction=desc"
	-d "last_edit.time[gt]=2020-06-28T23%3A59%3A59-5%3A00"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/campaigns/list

Postman Collection Item JSON

{
  "name": "Campaign List",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/campaigns/list?page=0&include_archived=false&sort_direction=desc&last_edit.time[gt]=2020-06-28T23:59:59-5:00",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "campaigns",
        "list"
      ],
      "query": [
        {
          "key": "page",
          "value": "0",
          "description": "(Optional) Integer\n\nThe page of campaigns to return, defaults to 0 (returns the first set of up to 100)"
        },
        {
          "key": "include_archived",
          "value": "false",
          "description": "(Optional) Boolean\n\nWhether or not to include archived campaigns, defaults to false"
        },
        {
          "key": "sort_direction",
          "value": "desc",
          "description": "(Optional) String\n\nPass in the value `desc` to sort by creation time from newest to oldest. Pass in `asc` to sort from oldest to newest. If sort_direction is not included, the default order is oldest to newest."
        },
        {
          "key": "last_edit.time[gt]",
          "value": "2020-06-28T23:59:59-5:00",
          "description": "(Optional) DateTime (ISO 8601 string)\n\nFilters the results and only returns campaigns that were edited greater than the time provided till now. "
        }
      ]
    },
    "description": "This endpoint allows you to export a list of campaigns, each of which will include its name, Campaign API Identifier, whether it is an API Campaign, and Tags associated with the campaign. The campaigns are returned in groups of 100 sorted by time of creation (oldest to newest by default).\n\n## Campaign List Endpoint API Response\n\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR-REST-API-KEY\n{\n    \"message\": (required, string) the status of the export, returns 'success' when completed without errors,\n    \"campaigns\" : [\n        {\n            \"id\" : (string) Campaign API Identifier,\n            \"last_edited\": (ISO 8601 string) the last edited time for the message \n            \"name\" : (string) campaign name,\n            \"is_api_campaign\" : (boolean) whether the campaign is an API Campaign,\n            \"tags\" : (array) tag names associated with the campaign\n        },\n        ...\n    ]\n}\n```"
  },
  "response": [
  ]
}