Chilkat Online Tools

SQL Server / Bond APIs / get all customers

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', @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

Postman Collection Item JSON

{
  "name": "get all customers",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "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",
      "protocol": "https",
      "host": [
        "{{environment}}",
        "bond",
        "tech"
      ],
      "path": [
        "api",
        "v0",
        "customers"
      ]
    },
    "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    {\n        \"customer_id\": \"6fa0b0aa-b175-413d-8296-55a9fe6c83d0\",\n        \"bond_brand_id\": \"00000000-0000-0000-0000-000000000000\",\n        \"brand_person_id\": \"b4a1f297-d50f-42ce-a88c-fc514bf8c4fb\",\n        \"date_created\": \"2020-12-11T23:19:39.368519+00:00\",\n        \"dob\": \"1990-01-01\",\n        \"first_name\": \"Alexandra\",\n        \"middle_name\": \"\",\n        \"last_name\": \"Bond\",\n        \"kyc_requests_available\": 2,\n        \"addresses\": [\n            {\n                \"address_id\": \"f013b81e-5adf-48ab-8d03-1e13b2275e90\",\n                \"address_type\": \"PHYSICAL\",\n                \"street\": \"345 California Street\",\n                \"street2\": \"\",\n                \"city\": \"San Francisco\",\n                \"state\": \"CA\",\n                \"zip_code\": \"12345\",\n                \"country\": \"US\",\n                \"is_primary\": true,\n                \"deliverability\": \"init\",\n                \"date_created\": \"2020-12-11T23:19:39.390958+00:00\"\n            }\n        ]\n    },\n    {\n        \"customer_id\": \"c3da0557-3695-460a-8135-bbd63ac57e11\",\n        \"bond_brand_id\": \"00000000-0000-0000-0000-000000000000\",\n        \"brand_person_id\": \"c65395fa-35f2-4158-9717-5741480d1c7d\",\n        \"date_created\": \"2020-12-14T22:11:34.544644+00:00\",\n        \"dob\": \"1991-01-01\",\n        \"first_name\": \"Chia Chi\",\n        \"middle_name\": \"Amazing\",\n        \"last_name\": \"Chuang\",\n        \"kyc_requests_available\": 3,\n        \"addresses\": [\n            {\n                \"address_id\": \"26b7160c-b1e1-4bb4-949c-9014b71cc19f\",\n                \"address_type\": \"PHYSICAL\",\n                \"street\": \"345 California Ave.\",\n                \"street2\": \"\",\n                \"city\": \"San Jose\",\n                \"state\": \"CA\",\n                \"zip_code\": \"12345-1111\",\n                \"country\": \"US\",\n                \"is_primary\": true,\n                \"deliverability\": \"init\",\n                \"date_created\": \"2020-12-14T22:11:34.567038+00:00\"\n            },\n            {\n                \"address_id\": \"768bf8f7-08c1-415e-b729-20c631d8eeb9\",\n                \"address_type\": \"MAILING\",\n                \"street\": \"345 California Ave.\",\n                \"street2\": \"\",\n                \"city\": \"San Jose\",\n                \"state\": \"CA\",\n                \"zip_code\": \"12345\",\n                \"country\": \"US\",\n                \"is_primary\": false,\n                \"deliverability\": \"init\",\n                \"date_created\": \"2020-12-14T22:11:34.585389+00:00\"\n            }\n        ]\n    }\n]"
    }
  ]
}