Chilkat Online Tools

SQL Server / Braze Endpoints / See Content Block Information

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, 'content_block_id', '{{content_block_id}}'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'include_inclusion_data', 'No'

    -- 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/content_blocks/info', @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 "content_block_id=%7B%7Bcontent_block_id%7D%7D"
	-d "include_inclusion_data=No"
	-H "Authorization: Bearer {{api_key}}"
https://rest.iad-01.braze.com/content_blocks/info

Postman Collection Item JSON

{
  "name": "See Content Block Information",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{api_key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{instance_url}}/content_blocks/info?content_block_id={{content_block_id}}&include_inclusion_data=No",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "content_blocks",
        "info"
      ],
      "query": [
        {
          "key": "content_block_id",
          "value": "{{content_block_id}}",
          "description": "(Required) String\n\nThe Content Block ID. This can be found by either listing Content Block information or going to the Developer Console, then API Settings, then scrolling to the bottom and searching for your Content Block API Identifier."
        },
        {
          "key": "include_inclusion_data",
          "value": "No",
          "description": "(Optional) Boolean\n\nWhen set to ‘true’, the API returns back the Message Variation API ID of Campaigns and Canvases where this content block is included, to be used in subsequent calls. The results exclude archived or deleted Campaigns or Canvases."
        }
      ]
    },
    "description": "This endpoint will call information for an existing Content Block.\n\n### Successful Response Properties\n```json\nContent-Type: application/json\nAuthorization: Bearer YOUR_REST_API_KEY\n{\n  \"content_block_id\": \"string\",\n  \"name\": \"string\",\n  \"content\": \"string\",\n  \"description\": \"string\",\n  \"content_type\": \"html or text\",\n  \"tags\":  \"array of strings\",\n  \"created_at\": \"time-in-iso\",\n  \"last_edited\": \"time-in-iso\",\n  \"inclusion_count\" : \"integer\",\n  \"message\": \"success\"\n}\n```\n\n### Possible Errors\n- `Content Block ID cannot be blank.` - A Content Block has not been listed or is not encapsulated in quotes.\n\n- `Content Block ID is invalid for this App Group.` - This Content Block does not exist or is in a different company account or app group.\n\n- `Content Block has been deleted - content not available.` - This Content Block, though it may have existed earlier, has been deleted.\n\n- `Include Inclusion Data - error` - One of true or false is not provided."
  },
  "response": [
  ]
}