Chilkat Online Tools

SQL Server / Belvo API Docs / List

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
    -- 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_OASetProperty @http, 'BasicAuth', 1
    EXEC sp_OASetProperty @http, 'Login', '{{secretId}}'
    EXEC sp_OASetProperty @http, 'Password', '{{secretPassword}}'

    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://domain.com/api/accounts/', @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

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

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "count": "<integer>",
    --   "next": "<string>",
    --   "previous": "<string>",
    --   "results": [
    --     {
    --       "link": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "institution": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "collected_at": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "category": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "type": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "name": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "number": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "balance": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "currency": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "bank_product_id": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "internal_identification": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "public_identification_name": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "public_identification_value": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "last_accessed_at": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "credit_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "loan_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "funds_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "gig_payment_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       }
    --     },
    --     {
    --       "link": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "institution": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "collected_at": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "category": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "type": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "name": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "number": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "balance": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "currency": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "bank_product_id": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "internal_identification": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "public_identification_name": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "public_identification_value": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "last_accessed_at": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "credit_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "loan_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "funds_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       },
    --       "gig_payment_data": {
    --         "value": "<Error: Too many levels of nesting to fake this schema>"
    --       }
    --     }
    --   ]
    -- }

    -- Sample code for parsing the JSON response...
    -- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    DECLARE @Value nvarchar(4000)

    DECLARE @institutionValue nvarchar(4000)

    DECLARE @collected_atValue nvarchar(4000)

    DECLARE @categoryValue nvarchar(4000)

    DECLARE @typeValue nvarchar(4000)

    DECLARE @nameValue nvarchar(4000)

    DECLARE @numberValue nvarchar(4000)

    DECLARE @balanceValue nvarchar(4000)

    DECLARE @currencyValue nvarchar(4000)

    DECLARE @bank_product_idValue nvarchar(4000)

    DECLARE @internal_identificationValue nvarchar(4000)

    DECLARE @public_identification_nameValue nvarchar(4000)

    DECLARE @public_identification_valueValue nvarchar(4000)

    DECLARE @last_accessed_atValue nvarchar(4000)

    DECLARE @credit_dataValue nvarchar(4000)

    DECLARE @loan_dataValue nvarchar(4000)

    DECLARE @funds_dataValue nvarchar(4000)

    DECLARE @gig_payment_dataValue nvarchar(4000)

    DECLARE @count nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @count OUT, 'count'
    DECLARE @v_next nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_next OUT, 'next'
    DECLARE @previous nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @previous OUT, 'previous'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'results'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @Value OUT, 'results[i].link.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @institutionValue OUT, 'results[i].institution.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @collected_atValue OUT, 'results[i].collected_at.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @categoryValue OUT, 'results[i].category.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @typeValue OUT, 'results[i].type.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @nameValue OUT, 'results[i].name.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @numberValue OUT, 'results[i].number.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @balanceValue OUT, 'results[i].balance.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @currencyValue OUT, 'results[i].currency.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @bank_product_idValue OUT, 'results[i].bank_product_id.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @internal_identificationValue OUT, 'results[i].internal_identification.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @public_identification_nameValue OUT, 'results[i].public_identification_name.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @public_identification_valueValue OUT, 'results[i].public_identification_value.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @last_accessed_atValue OUT, 'results[i].last_accessed_at.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @credit_dataValue OUT, 'results[i].credit_data.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @loan_dataValue OUT, 'results[i].loan_data.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @funds_dataValue OUT, 'results[i].funds_data.value'
        EXEC sp_OAMethod @jResp, 'StringOf', @gig_payment_dataValue OUT, 'results[i].gig_payment_data.value'
        SELECT @i = @i + 1
      END

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


END
GO

Curl Command

curl -X GET
	-u '{{secretId}}:{{secretPassword}}'
https://domain.com/api/accounts/

Postman Collection Item JSON

{
  "name": "List",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/accounts/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "accounts",
        ""
      ],
      "query": [
        {
          "key": "page",
          "value": "1",
          "description": "A page number within the paginated result set.",
          "disabled": true
        }
      ]
    },
    "description": "Get a paginated list of all existing accounts in your Belvo account. We return up to 100 results per page.\n\n**Filterable fields**\n\nPlease see the table below for an alphabetized list of fields that you can filter your responses by. For more information on how to use filters, see our [Filtering responses](https://developers.belvo.com/docs/searching-and-filtering) article.\n\n|Field| Available Filters|\n|---|---|\n|`balance__available`|`=`, `gt`, `gte`, `lt`, `lte`, `range`|\n|`balance__current`|`=`, `gt`, `gte`, `lt`, `lte`, `range`|\n|`bank_product_id`|`=`|\n|`category`|`=`, `in`|\n|`collected_at`|`=`, `gt`, `gte`, `lt`, `lte`, `range`|\n|`currency`|`=`, `in`|\n|`id`|`=`, `in`|\n|`institution`|`=`, `in`|\n|`internal_identification`|`=`|\n|`link`|`=`, `in`|\n|`name`|`=`, `icontains`|\n|`number`|`=`, `in`|\n|`public_identification_name`|`=`|\n|`public_identification_value`|`=`|\n|`type`|`=`, `in`|"
  },
  "response": [
    {
      "name": "Ok",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/accounts?page=<integer>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "accounts"
          ],
          "query": [
            {
              "key": "page",
              "value": "<integer>"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n\t\"count\": \"<integer>\",\n\t\"next\": \"<string>\",\n\t\"previous\": \"<string>\",\n\t\"results\": [\n\t\t{\n\t\t\t\"link\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"institution\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"collected_at\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"category\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"type\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"name\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"number\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"balance\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"currency\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"bank_product_id\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"internal_identification\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"public_identification_name\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"public_identification_value\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"last_accessed_at\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"credit_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"loan_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"funds_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"gig_payment_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"link\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"institution\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"collected_at\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"category\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"type\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"name\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"number\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"balance\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"currency\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"bank_product_id\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"internal_identification\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"public_identification_name\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"public_identification_value\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"last_accessed_at\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"credit_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"loan_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"funds_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t\"gig_payment_data\": {\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t}\n\t\t}\n\t]\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/accounts?page=<integer>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "accounts"
          ],
          "query": [
            {
              "key": "page",
              "value": "<integer>"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "[\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t},\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t}\n]"
    }
  ]
}