Chilkat Online Tools

SQL Server / Bond APIs / get customer

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, 'Content-Type', 'application/json'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{authorization}}'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Identity', '{{identity}}'

    DECLARE @sbResponseBody int
    -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://{{environment}}.bond.tech/api/v0/customers/{{customer_id}}', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END


    EXEC sp_OAGetProperty @http, 'LastStatus', @iTmp0 OUT
    PRINT 'Response status code = ' + @iTmp0
    EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
    PRINT @sTmp0

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody


END
GO

Curl Command

curl -X GET
	-H "Content-Type: application/json"
	-H "Authorization: {{authorization}}"
	-H "Identity: {{identity}}"
https://{{environment}}.bond.tech/api/v0/customers/{{customer_id}}

Postman Collection Item JSON

{
  "name": "get customer",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "{{authorization}}"
      },
      {
        "key": "Identity",
        "type": "text",
        "value": "{{identity}}"
      }
    ],
    "url": {
      "raw": "https://{{environment}}.bond.tech/api/v0/customers/{{customer_id}}",
      "protocol": "https",
      "host": [
        "{{environment}}",
        "bond",
        "tech"
      ],
      "path": [
        "api",
        "v0",
        "customers",
        "{{customer_id}}"
      ]
    },
    "description": "Add Card financial Core"
  },
  "response": [
    {
      "name": "example",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "type": "text",
            "value": "application/json"
          },
          {
            "key": "Authorization",
            "type": "text",
            "value": "{{authorization}}"
          },
          {
            "key": "Identity",
            "type": "text",
            "value": "{{identity}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": ""
        },
        "url": {
          "raw": "https://{{environment}}.bond.tech/api/v0/customers/{{customer_id}}",
          "protocol": "https",
          "host": [
            "{{environment}}",
            "bond",
            "tech"
          ],
          "path": [
            "api",
            "v0",
            "customers",
            "{{customer_id}}"
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"customer_id\": \"8559dec0-2edb-4c3c-a3c5-32de10174c34\",\n    \"brand_person_id\": \"7b18da9e-0217-4ecb-8454-8c0ab8bedc14\",\n    \"bond_brand_id\": \"e2b37ab8-5e6e-4538-bbe0-35121b481845\",\n    \"date_created\": \"2020-10-26T21:48:57.287919\",\n    \"dob\": \"1997-12-25\",\n    \"first_name\": \"Christine\",\n    \"middle_name\": \"J\",\n    \"last_name\": \"Smith\",\n    \"kyc_requests_available\": 3,\n    \"addresses\": [\n        {\n            \"address_id\": \"9e8241d2-ac5e-41c6-8b38-b3fe44387266\",\n            \"address_type\": \"PHYSICAL\",\n            \"street\": \"345 California St.\",\n            \"street2\": \"Suit 600\",\n            \"city\": \"San Francisco\",\n            \"state\": \"CA\",\n            \"zip_code\": \"94104-2657\",\n            \"country\": \"US\",\n            \"is_primary\": true,\n            \"deliverability\": \"deliverable\",\n            \"date_created\": \"2020-10-26T21:48:57.287919\"\n        },\n        {\n            \"address_id\": \"242c459e-6bd5-4158-89ee-550f0bdd133d\",\n            \"address_type\": \"MAILING\",\n            \"street\": \"111 Lake Tahoe Rd.\",\n            \"street2\": \"\",\n            \"city\": \"San Francisco\",\n            \"state\": \"CA\",\n            \"zip_code\": \"12345\",\n            \"country\": \"US\",\n            \"is_primary\": false,\n            \"deliverability\": \"undeliverable\",\n            \"date_created\": \"2020-10-26T21:48:57.287919\"\n        }\n    ]\n}"
    }
  ]
}