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/transactions/: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
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)
-- {
-- "id": "<uuid>",
-- "account": {
-- "id": "<uuid>",
-- "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>"
-- }
-- },
-- "collected_at": "<date>",
-- "value_date": "<string>",
-- "accounting_date": "<date>",
-- "amount": "<number>",
-- "balance": "<number>",
-- "currency": "<string>",
-- "description": "<string>",
-- "observations": "<string>",
-- "category": "<string>",
-- "reference": "<string>",
-- "type": "eiusmod veniam ea sint",
-- "status": "est nostrud",
-- "gig_data": {
-- "pickup_at": "<dateTime>",
-- "dropoff_at": "<dateTime>",
-- "request_at": "<dateTime>",
-- "pickup_address": "<string>",
-- "dropoff_address": "<string>",
-- "pickup_latitude": "<number>",
-- "pickup_longitude": "<number>",
-- "dropoff_latitude": "<number>",
-- "dropoff_longitude": "<number>",
-- "distance": "<number>",
-- "payment_method": "<string>",
-- "vehicle_type": "<string>",
-- "merchant_type": "<string>",
-- "breakdown": [
-- {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- },
-- {
-- "value": "<Error: Too many levels of nesting to fake this schema>"
-- }
-- ],
-- "collected_at": "<dateTime>"
-- },
-- "credit_card_data": {
-- "bill_name": "<string>"
-- }
-- }
-- 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 @id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'id'
DECLARE @Id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'account.id'
DECLARE @Value nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Value OUT, 'account.link.value'
DECLARE @InstitutionValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @InstitutionValue OUT, 'account.institution.value'
DECLARE @Collected_atValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Collected_atValue OUT, 'account.collected_at.value'
DECLARE @CategoryValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @CategoryValue OUT, 'account.category.value'
DECLARE @TypeValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @TypeValue OUT, 'account.type.value'
DECLARE @NameValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @NameValue OUT, 'account.name.value'
DECLARE @NumberValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @NumberValue OUT, 'account.number.value'
DECLARE @BalanceValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @BalanceValue OUT, 'account.balance.value'
DECLARE @CurrencyValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @CurrencyValue OUT, 'account.currency.value'
DECLARE @Bank_product_idValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Bank_product_idValue OUT, 'account.bank_product_id.value'
DECLARE @Internal_identificationValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Internal_identificationValue OUT, 'account.internal_identification.value'
DECLARE @Public_identification_nameValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Public_identification_nameValue OUT, 'account.public_identification_name.value'
DECLARE @Public_identification_valueValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Public_identification_valueValue OUT, 'account.public_identification_value.value'
DECLARE @Last_accessed_atValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Last_accessed_atValue OUT, 'account.last_accessed_at.value'
DECLARE @Credit_dataValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Credit_dataValue OUT, 'account.credit_data.value'
DECLARE @Loan_dataValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Loan_dataValue OUT, 'account.loan_data.value'
DECLARE @Funds_dataValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Funds_dataValue OUT, 'account.funds_data.value'
DECLARE @Gig_payment_dataValue nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Gig_payment_dataValue OUT, 'account.gig_payment_data.value'
DECLARE @collected_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @collected_at OUT, 'collected_at'
DECLARE @value_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @value_date OUT, 'value_date'
DECLARE @accounting_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @accounting_date OUT, 'accounting_date'
DECLARE @amount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @amount OUT, 'amount'
DECLARE @balance nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @balance OUT, 'balance'
DECLARE @v_currency nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_currency OUT, 'currency'
DECLARE @description nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'description'
DECLARE @observations nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @observations OUT, 'observations'
DECLARE @category nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @category OUT, 'category'
DECLARE @reference nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @reference OUT, 'reference'
DECLARE @v_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'type'
DECLARE @status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status'
DECLARE @Pickup_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Pickup_at OUT, 'gig_data.pickup_at'
DECLARE @Dropoff_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dropoff_at OUT, 'gig_data.dropoff_at'
DECLARE @Request_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Request_at OUT, 'gig_data.request_at'
DECLARE @Pickup_address nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Pickup_address OUT, 'gig_data.pickup_address'
DECLARE @Dropoff_address nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dropoff_address OUT, 'gig_data.dropoff_address'
DECLARE @Pickup_latitude nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Pickup_latitude OUT, 'gig_data.pickup_latitude'
DECLARE @Pickup_longitude nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Pickup_longitude OUT, 'gig_data.pickup_longitude'
DECLARE @Dropoff_latitude nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dropoff_latitude OUT, 'gig_data.dropoff_latitude'
DECLARE @Dropoff_longitude nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Dropoff_longitude OUT, 'gig_data.dropoff_longitude'
DECLARE @Distance nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Distance OUT, 'gig_data.distance'
DECLARE @Payment_method nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Payment_method OUT, 'gig_data.payment_method'
DECLARE @Vehicle_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Vehicle_type OUT, 'gig_data.vehicle_type'
DECLARE @Merchant_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Merchant_type OUT, 'gig_data.merchant_type'
DECLARE @Collected_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Collected_at OUT, 'gig_data.collected_at'
DECLARE @Bill_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Bill_name OUT, 'credit_card_data.bill_name'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'gig_data.breakdown'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'gig_data.breakdown[i].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/transactions/:id/
Postman Collection Item JSON
{
"name": "Detail",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/transactions/:id/",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"transactions",
":id",
""
],
"variable": [
{
"key": "id",
"value": "consequa",
"description": "(Required) The `transaction.id` you want to get detailed information about."
}
]
},
"description": "Get the details of a specific transaction."
},
"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/transactions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"transactions",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n\t\"id\": \"<uuid>\",\n\t\"account\": {\n\t\t\"id\": \"<uuid>\",\n\t\t\"link\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"institution\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"collected_at\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"category\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"name\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"number\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"balance\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"currency\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"bank_product_id\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"internal_identification\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"public_identification_name\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"public_identification_value\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"last_accessed_at\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"credit_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"loan_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"funds_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"gig_payment_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t}\n\t},\n\t\"collected_at\": \"<date>\",\n\t\"value_date\": \"<string>\",\n\t\"accounting_date\": \"<date>\",\n\t\"amount\": \"<number>\",\n\t\"balance\": \"<number>\",\n\t\"currency\": \"<string>\",\n\t\"description\": \"<string>\",\n\t\"observations\": \"<string>\",\n\t\"category\": \"<string>\",\n\t\"reference\": \"<string>\",\n\t\"type\": \"eiusmod veniam ea sint\",\n\t\"status\": \"est nostrud\",\n\t\"gig_data\": {\n\t\t\"pickup_at\": \"<dateTime>\",\n\t\t\"dropoff_at\": \"<dateTime>\",\n\t\t\"request_at\": \"<dateTime>\",\n\t\t\"pickup_address\": \"<string>\",\n\t\t\"dropoff_address\": \"<string>\",\n\t\t\"pickup_latitude\": \"<number>\",\n\t\t\"pickup_longitude\": \"<number>\",\n\t\t\"dropoff_latitude\": \"<number>\",\n\t\t\"dropoff_longitude\": \"<number>\",\n\t\t\"distance\": \"<number>\",\n\t\t\"payment_method\": \"<string>\",\n\t\t\"vehicle_type\": \"<string>\",\n\t\t\"merchant_type\": \"<string>\",\n\t\t\"breakdown\": [\n\t\t\t{\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t{\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\"collected_at\": \"<dateTime>\"\n\t},\n\t\"credit_card_data\": {\n\t\t\"bill_name\": \"<string>\"\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/transactions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"transactions",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"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]"
},
{
"name": "Too Many Sessions",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/transactions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"transactions",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_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]"
}
]
}