Chilkat Online Tools

SQL Server / Bond APIs / delete webhook

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

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Identity', '{{identity}}'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{authorization}}'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'DELETE', 'https://{{environment}}.bond.tech/api/v0/webhooks/:webhook_id'
    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
        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


END
GO

Curl Command

curl -X DELETE
	-H "Identity: {{identity}}"
	-H "Authorization: {{authorization}}"
https://{{environment}}.bond.tech/api/v0/webhooks/:webhook_id

Postman Collection Item JSON

{
  "name": "delete webhook",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Identity",
        "value": "{{identity}}",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "{{authorization}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://{{environment}}.bond.tech/api/v0/webhooks/:webhook_id",
      "protocol": "https",
      "host": [
        "{{environment}}",
        "bond",
        "tech"
      ],
      "path": [
        "api",
        "v0",
        "webhooks",
        ":webhook_id"
      ],
      "variable": [
        {
          "key": "webhook_id",
          "value": "{{webhook_id}}"
        }
      ]
    }
  },
  "response": [
    {
      "name": "delete webhook",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "key": "Identity",
            "value": "{{identity}}",
            "type": "text"
          },
          {
            "key": "Authorization",
            "value": "{{authorization}}",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://{{environment}}.bond.tech/api/v0/webhooks/:webhook_id",
          "protocol": "https",
          "host": [
            "{{environment}}",
            "bond",
            "tech"
          ],
          "path": [
            "api",
            "v0",
            "webhooks",
            ":webhook_id"
          ],
          "variable": [
            {
              "key": "webhook_id",
              "value": ""
            }
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n  \"deleted_at\": \"2020-11-17T12:39:24.546147\",\n  \"date_created\": \"2020-11-17T12:39:12.846994\",\n  \"webhook_id\": \"d2413481-6564-4977-a1cc-aefcba5f89b6\",\n  \"callback_url\": \"https://hostname.com/webhook/route\",\n  \"description\": \"KYC state changes.\",\n  \"events\": [\n    \"kyc.verification.success\",\n    \"kyc.verification.failure\",\n    \"kyc.verification.kba\",\n    \"kyc.verification.error\",\n    \"kyc.verification.timeout\"\n  ],\n  \"status\": \"disabled\",\n  \"secret\": \"whsec_fmLMp39V+u4q8mQsizj+LTELLO5j5m0z\"\n}"
    }
  ]
}