Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sName
String sId
String sV_Email
String sScurrency_symbol
String sAccount_Type
String sSIC_Code
String sSsharing_permission
String sLast_Activity_Time
String sIndustry
String sAccount_Site
String sSstate
Boolean iSprocess_flow
Integer iExchange_Rate
String sBilling_Country
String sV_Currency
String sId
Boolean iSapproved
Boolean iDelegate
Boolean iApprove
Boolean iReject
Boolean iResubmit
String sBilling_Street
String sCreated_Time
Boolean iSeditable
String sBilling_Code
String sShipping_City
String sShipping_Country
String sShipping_Code
String sBilling_City
String sCreated_ByName
String sCreated_ById
String sCreated_ByEmail
Integer iAnnual_Revenue
String sShipping_Street
String sTerritory_updated_time
String sOwnership
String sDescription
String sRating
String sShipping_State
Boolean iSreview_processApprove
Boolean iSreview_processReject
Boolean iSreview_processResubmit
String sWebsite
String sEmployees
String sRecord_Image
String sModified_ByName
String sModified_ById
String sModified_ByEmail
String sSreview
String sPhone
String sAccount_Name
String sAccount_Number
String sTicker_Symbol
String sModified_Time
Boolean iSorchestration
String sParent_Account
Boolean iSin_merge
String sBilling_State
String sFax
String sSapproval_state
Integer j
Integer iCount_j
String sSassigned
String sSassigned_time
String sSassigned_by
Integer iPer_page
Integer iCount
Integer iPage
Boolean iMore_records
Integer i
Integer iCount_i
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// Adds the "Authorization: Bearer <access_token>" header.
Set ComAuthToken Of hoHttp To "<access_token>"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://domain.com/crm/v2.1/Accounts" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "data": [
// {
// "Owner": {
// "name": "patricia patricia",
// "id": "738964000000291009",
// "email": "patricia.ss@zylker.com"
// },
// "$currency_symbol": "Af",
// "Account_Type": null,
// "SIC_Code": null,
// "$sharing_permission": "full_access",
// "Last_Activity_Time": "2021-04-21T08:53:58+00:00",
// "Industry": null,
// "Account_Site": null,
// "$state": "save",
// "$process_flow": false,
// "Exchange_Rate": 1,
// "Billing_Country": null,
// "Currency": "AFN",
// "id": "738964000002058030",
// "$approved": true,
// "$approval": {
// "delegate": false,
// "approve": false,
// "reject": false,
// "resubmit": false
// },
// "Billing_Street": null,
// "Created_Time": "2021-04-21T08:53:58+00:00",
// "$editable": true,
// "Billing_Code": "1234",
// "Shipping_City": null,
// "Shipping_Country": null,
// "Shipping_Code": null,
// "Billing_City": null,
// "Created_By": {
// "name": "patricia patricia",
// "id": "738964000000291009",
// "email": "patricia.ss@zylker.com"
// },
// "Annual_Revenue": 1,
// "Shipping_Street": null,
// "territory_updated_time": null,
// "Ownership": null,
// "Description": null,
// "Rating": null,
// "Shipping_State": null,
// "$review_process": {
// "approve": false,
// "reject": false,
// "resubmit": false
// },
// "Website": "https://yaythisworked.com",
// "Employees": null,
// "Record_Image": null,
// "Modified_By": {
// "name": "patricia patricia",
// "id": "738964000000291009",
// "email": "patricia.ss@zylker.com"
// },
// "$review": null,
// "Phone": null,
// "Account_Name": "Zylker",
// "Account_Number": "0",
// "Ticker_Symbol": null,
// "Modified_Time": "2021-04-21T08:53:58+00:00",
// "Territories": [
// {
// "$assigned": "automatically",
// "$assigned_time": "2021-04-21T08:54:13+00:00",
// "id": "738964000001977355",
// "$assigned_by": null,
// "Name": "South Zone"
// }
// ],
// "$orchestration": false,
// "Parent_Account": null,
// "$in_merge": false,
// "Billing_State": "Colorado",
// "Tag": [
// ],
// "Fax": null,
// "$approval_state": "approved"
// }
// ],
// "info": {
// "per_page": 200,
// "count": 1,
// "page": 1,
// "more_records": false
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComIntOf Of hoJResp "info.per_page" To iPer_page
Get ComIntOf Of hoJResp "info.count" To iCount
Get ComIntOf Of hoJResp "info.page" To iPage
Get ComBoolOf Of hoJResp "info.more_records" To iMore_records
Move 0 To i
Get ComSizeOfArray Of hoJResp "data" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "data[i].Owner.name" To sName
Get ComStringOf Of hoJResp "data[i].Owner.id" To sId
Get ComStringOf Of hoJResp "data[i].Owner.email" To sV_Email
Get ComStringOf Of hoJResp "data[i].$currency_symbol" To sScurrency_symbol
Get ComStringOf Of hoJResp "data[i].Account_Type" To sAccount_Type
Get ComStringOf Of hoJResp "data[i].SIC_Code" To sSIC_Code
Get ComStringOf Of hoJResp "data[i].$sharing_permission" To sSsharing_permission
Get ComStringOf Of hoJResp "data[i].Last_Activity_Time" To sLast_Activity_Time
Get ComStringOf Of hoJResp "data[i].Industry" To sIndustry
Get ComStringOf Of hoJResp "data[i].Account_Site" To sAccount_Site
Get ComStringOf Of hoJResp "data[i].$state" To sSstate
Get ComBoolOf Of hoJResp "data[i].$process_flow" To iSprocess_flow
Get ComIntOf Of hoJResp "data[i].Exchange_Rate" To iExchange_Rate
Get ComStringOf Of hoJResp "data[i].Billing_Country" To sBilling_Country
Get ComStringOf Of hoJResp "data[i].Currency" To sV_Currency
Get ComStringOf Of hoJResp "data[i].id" To sId
Get ComBoolOf Of hoJResp "data[i].$approved" To iSapproved
Get ComBoolOf Of hoJResp "data[i].$approval.delegate" To iDelegate
Get ComBoolOf Of hoJResp "data[i].$approval.approve" To iApprove
Get ComBoolOf Of hoJResp "data[i].$approval.reject" To iReject
Get ComBoolOf Of hoJResp "data[i].$approval.resubmit" To iResubmit
Get ComStringOf Of hoJResp "data[i].Billing_Street" To sBilling_Street
Get ComStringOf Of hoJResp "data[i].Created_Time" To sCreated_Time
Get ComBoolOf Of hoJResp "data[i].$editable" To iSeditable
Get ComStringOf Of hoJResp "data[i].Billing_Code" To sBilling_Code
Get ComStringOf Of hoJResp "data[i].Shipping_City" To sShipping_City
Get ComStringOf Of hoJResp "data[i].Shipping_Country" To sShipping_Country
Get ComStringOf Of hoJResp "data[i].Shipping_Code" To sShipping_Code
Get ComStringOf Of hoJResp "data[i].Billing_City" To sBilling_City
Get ComStringOf Of hoJResp "data[i].Created_By.name" To sCreated_ByName
Get ComStringOf Of hoJResp "data[i].Created_By.id" To sCreated_ById
Get ComStringOf Of hoJResp "data[i].Created_By.email" To sCreated_ByEmail
Get ComIntOf Of hoJResp "data[i].Annual_Revenue" To iAnnual_Revenue
Get ComStringOf Of hoJResp "data[i].Shipping_Street" To sShipping_Street
Get ComStringOf Of hoJResp "data[i].territory_updated_time" To sTerritory_updated_time
Get ComStringOf Of hoJResp "data[i].Ownership" To sOwnership
Get ComStringOf Of hoJResp "data[i].Description" To sDescription
Get ComStringOf Of hoJResp "data[i].Rating" To sRating
Get ComStringOf Of hoJResp "data[i].Shipping_State" To sShipping_State
Get ComBoolOf Of hoJResp "data[i].$review_process.approve" To iSreview_processApprove
Get ComBoolOf Of hoJResp "data[i].$review_process.reject" To iSreview_processReject
Get ComBoolOf Of hoJResp "data[i].$review_process.resubmit" To iSreview_processResubmit
Get ComStringOf Of hoJResp "data[i].Website" To sWebsite
Get ComStringOf Of hoJResp "data[i].Employees" To sEmployees
Get ComStringOf Of hoJResp "data[i].Record_Image" To sRecord_Image
Get ComStringOf Of hoJResp "data[i].Modified_By.name" To sModified_ByName
Get ComStringOf Of hoJResp "data[i].Modified_By.id" To sModified_ById
Get ComStringOf Of hoJResp "data[i].Modified_By.email" To sModified_ByEmail
Get ComStringOf Of hoJResp "data[i].$review" To sSreview
Get ComStringOf Of hoJResp "data[i].Phone" To sPhone
Get ComStringOf Of hoJResp "data[i].Account_Name" To sAccount_Name
Get ComStringOf Of hoJResp "data[i].Account_Number" To sAccount_Number
Get ComStringOf Of hoJResp "data[i].Ticker_Symbol" To sTicker_Symbol
Get ComStringOf Of hoJResp "data[i].Modified_Time" To sModified_Time
Get ComBoolOf Of hoJResp "data[i].$orchestration" To iSorchestration
Get ComStringOf Of hoJResp "data[i].Parent_Account" To sParent_Account
Get ComBoolOf Of hoJResp "data[i].$in_merge" To iSin_merge
Get ComStringOf Of hoJResp "data[i].Billing_State" To sBilling_State
Get ComStringOf Of hoJResp "data[i].Fax" To sFax
Get ComStringOf Of hoJResp "data[i].$approval_state" To sSapproval_state
Move 0 To j
Get ComSizeOfArray Of hoJResp "data[i].Territories" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "data[i].Territories[j].$assigned" To sSassigned
Get ComStringOf Of hoJResp "data[i].Territories[j].$assigned_time" To sSassigned_time
Get ComStringOf Of hoJResp "data[i].Territories[j].id" To sId
Get ComStringOf Of hoJResp "data[i].Territories[j].$assigned_by" To sSassigned_by
Get ComStringOf Of hoJResp "data[i].Territories[j].Name" To sName
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "data[i].Tag" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2.1/Accounts
Postman Collection Item JSON
{
"name": "Accounts",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts"
]
},
"description": "To get the list of available records in the Accounts module."
},
"response": [
{
"name": "P8: territory_id",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts?territory_id=738964000001977355",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts"
],
"query": [
{
"key": "territory_id",
"value": "738964000001977355"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Wed, 05 May 2021 06:44:50 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-05T07:39:40+00:00"
},
{
"key": "clientVersion",
"value": "4009533"
},
{
"key": "clientsubVersion",
"value": "cfa914635a0a376a1322139140e8bf37"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "vary",
"value": "accept-encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Content-Language",
"value": "en-US"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=15768000"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"Owner\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$currency_symbol\": \"Af\",\n \"Account_Type\": null,\n \"SIC_Code\": null,\n \"$sharing_permission\": \"full_access\",\n \"Last_Activity_Time\": \"2021-04-21T08:53:58+00:00\",\n \"Industry\": null,\n \"Account_Site\": null,\n \"$state\": \"save\",\n \"$process_flow\": false,\n \"Exchange_Rate\": 1,\n \"Billing_Country\": null,\n \"Currency\": \"AFN\",\n \"id\": \"738964000002058030\",\n \"$approved\": true,\n \"$approval\": {\n \"delegate\": false,\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"Billing_Street\": null,\n \"Created_Time\": \"2021-04-21T08:53:58+00:00\",\n \"$editable\": true,\n \"Billing_Code\": \"1234\",\n \"Shipping_City\": null,\n \"Shipping_Country\": null,\n \"Shipping_Code\": null,\n \"Billing_City\": null,\n \"Created_By\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"Annual_Revenue\": 1,\n \"Shipping_Street\": null,\n \"territory_updated_time\": null,\n \"Ownership\": null,\n \"Description\": null,\n \"Rating\": null,\n \"Shipping_State\": null,\n \"$review_process\": {\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"Website\": \"https://yaythisworked.com\",\n \"Employees\": null,\n \"Record_Image\": null,\n \"Modified_By\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$review\": null,\n \"Phone\": null,\n \"Account_Name\": \"Zylker\",\n \"Account_Number\": \"0\",\n \"Ticker_Symbol\": null,\n \"Modified_Time\": \"2021-04-21T08:53:58+00:00\",\n \"Territories\": [\n {\n \"$assigned\": \"automatically\",\n \"$assigned_time\": \"2021-04-21T08:54:13+00:00\",\n \"id\": \"738964000001977355\",\n \"$assigned_by\": null,\n \"Name\": \"South Zone\"\n }\n ],\n \"$orchestration\": false,\n \"Parent_Account\": null,\n \"$in_merge\": false,\n \"Billing_State\": \"Colorado\",\n \"Tag\": [],\n \"Fax\": null,\n \"$approval_state\": \"approved\"\n }\n ],\n \"info\": {\n \"per_page\": 200,\n \"count\": 1,\n \"page\": 1,\n \"more_records\": false\n }\n}"
},
{
"name": "P9: include_child",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts?territory_id=738964000001977355&include_child=true",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts"
],
"query": [
{
"key": "territory_id",
"value": "738964000001977355"
},
{
"key": "include_child",
"value": "true"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Wed, 05 May 2021 06:45:34 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-05T07:39:40+00:00"
},
{
"key": "clientVersion",
"value": "4009533"
},
{
"key": "clientsubVersion",
"value": "cfa914635a0a376a1322139140e8bf37"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "vary",
"value": "accept-encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Content-Language",
"value": "en-US"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=15768000"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"Owner\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$currency_symbol\": \"Af\",\n \"Account_Type\": null,\n \"SIC_Code\": null,\n \"$sharing_permission\": \"full_access\",\n \"Last_Activity_Time\": \"2021-04-21T08:53:58+00:00\",\n \"Industry\": null,\n \"Account_Site\": null,\n \"$state\": \"save\",\n \"$process_flow\": false,\n \"Exchange_Rate\": 1,\n \"Billing_Country\": null,\n \"Currency\": \"AFN\",\n \"id\": \"738964000002058030\",\n \"$approved\": true,\n \"$approval\": {\n \"delegate\": false,\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"Billing_Street\": null,\n \"Created_Time\": \"2021-04-21T08:53:58+00:00\",\n \"$editable\": true,\n \"Billing_Code\": \"1234\",\n \"Shipping_City\": null,\n \"Shipping_Country\": null,\n \"Shipping_Code\": null,\n \"Billing_City\": null,\n \"Created_By\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"Annual_Revenue\": 1,\n \"Shipping_Street\": null,\n \"territory_updated_time\": null,\n \"Ownership\": null,\n \"Description\": null,\n \"Rating\": null,\n \"Shipping_State\": null,\n \"$review_process\": {\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"Website\": \"https://yaythisworked.com\",\n \"Employees\": null,\n \"Record_Image\": null,\n \"Modified_By\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$review\": null,\n \"Phone\": null,\n \"Account_Name\": \"Zylker\",\n \"Account_Number\": \"0\",\n \"Ticker_Symbol\": null,\n \"Modified_Time\": \"2021-04-21T08:53:58+00:00\",\n \"Territories\": [\n {\n \"$assigned\": \"automatically\",\n \"$assigned_time\": \"2021-04-21T08:54:13+00:00\",\n \"id\": \"738964000001977355\",\n \"$assigned_by\": null,\n \"Name\": \"South Zone\"\n }\n ],\n \"$orchestration\": false,\n \"Parent_Account\": null,\n \"$in_merge\": false,\n \"Billing_State\": \"Colorado\",\n \"Tag\": [],\n \"Fax\": null,\n \"$approval_state\": \"approved\"\n }\n ],\n \"info\": {\n \"per_page\": 200,\n \"count\": 1,\n \"page\": 1,\n \"more_records\": false\n }\n}"
}
]
}