Chilkat Online Tools

SQL Server / Braze Endpoints / Campaign Details

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, 'campaign_id', '{{campaign_identifier}}'

    -- 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/campaigns/details', @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 "campaign_id=%7B%7Bcampaign_identifier%7D%7D"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/campaigns/details

Postman Collection Item JSON

{
  "name": "Campaign Details",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/campaigns/details?campaign_id={{campaign_identifier}}",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "campaigns",
        "details"
      ],
      "query": [
        {
          "key": "campaign_id",
          "value": "{{campaign_identifier}}",
          "description": "(Required) String\n\nCampaign API identifier"
        }
      ]
    },
    "description": "This endpoint allows you to retrieve relevant information on a specified campaign, which can be identified by the `campaign_id`. \n\n> The campaign_id for API campaigns can be found on the Developer Console page and the campaign details page within your dashboard or you can use the Campaign List Endpoint.\n\n### Components Used\n- [Campaign Identifier](https://www.braze.com/docs/api/identifier_types/)\n\n\n### Campaign Details 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    \"created_at\" : (string) date created as ISO 8601 date,\n    \"updated_at\" : (string) date last updated as ISO 8601 date,\n    \"archived\": (boolean) whether this Campaign is archived,\n    \"draft\": (boolean) whether this Campaign is a draft,\n    \"name\" : (string) campaign name,\n    \"description\" : (string) campaign description,\n    \"schedule_type\" : (string) type of scheduling action,\n    \"channels\" : (array) list of channels to send via,\n    \"first_sent\" : (string) date and hour of first sent as ISO 8601 date,\n    \"last_sent\" : (string) date and hour of last sent as ISO 8601 date,\n    \"tags\" : (array) tag names associated with the campaign,\n    \"messages\": {\n        \"message_variation_id\": (string) { // <=This is the actual id\n            \"channel\": (string) channel type of the message (as in, \"email\", \"ios_push\", \"webhook\", \"content_card\", \"in-app_message\", \"sms\"),\n            \"name\": (string) name of the message in the Dashboard (eg., \"Variation 1\")\n            ... channel-specific fields for this message, see below ...\n        }\n    },\n    \"conversion_behaviors\": (array) conversion event behaviors assigned to the campaign (see below)\n}\n```\n\n#### Messages\n\nThe `messages` response will contain information about each message. Example message responses for channels are below:\n\n##### Push Channels\n\n```json\n{\n    \"channel\": (string) description of the channel, such as \"ios_push\" or \"android_push\"\n    \"alert\": (string) alert body text,\n    \"extras\": (hash) any key value pairs provided\n}\n```\n\n##### Email Channel\n\n```json\n{\n    \"channel\": \"email\",\n    \"subject\": (string) subject,\n    \"body\": (string) HTML body,\n    \"from\": (string) from address and display name,\n    \"reply_to\": (string) reply-to for message, if different than \"from\" address,\n    \"title\": (string) name of the email,\n    \"extras\": (hash) any key value pairs provided\n}\n```\n\n##### Content Card Channel\n\n```json\n{\n    \"channel\": \"content_cards\",\n    \"name\": (string) name of variant,\n    \"extras\": (hash) any key value pairs provided; only present if at least one key-value pair has been set\n}\n```\n\n##### Webhook Channel\n\n```json\n{\n    \"channel\": \"webhook\",\n    \"url\": (string) url for webhook,\n    \"body\": (string) payload body,\n    \"type\": (string) body content type,\n    \"headers\": (hash) specified request headers,\n    \"method\": (string) HTTP method (e.g., \"POST\" or \"GET\"),\n}\n```\n\n##### SMS Channel\n\n```json\n{\n  \"channel\": \"sms\",\n  \"body\": (string) payload body,\n  \"from\": (string) list of numbers associated with the subscription group,\n  \"subscription_group_id\": (string) API id of the subscription group targeted in the SMS message\n}\n```\n\n##### Control Messages\n\n```json\n{\n    \"channel\": (string) description of the channel that the control is for,\n    \"type\": \"control\"\n}\n```\n\n#### Conversion Behaviors\n\nThe `conversion_behaviors` array will contain information about each conversion event behavior set for the campaign. These behaviors are in order as set by the campaign. For example, Conversion Event A will be the first item in the array, Conversion Event B will be second, etc. Example conversion event behavior responses for are below:\n\n##### Clicks Email\n\n```json\n{\n    \"type\": \"Clicks Email\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours\n}\n```\n\n##### Opens Email\n\n```json\n{\n    \"type\": \"Opens Email\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours\n}\n```\n\n##### Makes Purchase (any purchase)\n\n```json\n{\n    \"type\": \"Makes Any Purchase\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours\n}\n```\n\n##### Makes Purchase (specific product)\n\n```json\n{\n    \"type\": \"Makes Specific Purchase\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,\n    \"product\": (string) name of the product, i.e. - \"Feline Body Armor\"\n}\n```\n\n##### Performs Custom Event\n\n```json\n{\n    \"type\": \"Performs Custom Event\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,\n    \"custom_event_name\": (string) name of the event, i.e. - \"Used Feline Body Armor\"\n}\n```\n\n##### Upgrades App\n\n```json\n{\n    \"type\": \"Upgrades App\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,\n    \"app_ids\": (array|null) array of app ids, i.e. - [\"12345\", \"67890\"], or `null` if \"Track sessions for any app\" is selected in the UI\n}\n```\n\n##### Uses App\n\n```json\n{\n    \"type\": \"Starts Session\",\n    \"window\": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,\n    \"app_ids\": (array|null) array of app ids, i.e. - [\"12345\", \"67890\"], or `null` if \"Track sessions for any app\" is selected in the UI\n}\n```"
  },
  "response": [
  ]
}