Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcName
LOCAL lcId
LOCAL lcV_Email
LOCAL lcScurrency_symbol
LOCAL lcAccount_Type
LOCAL lcSIC_Code
LOCAL lcLast_Activity_Time
LOCAL lcIndustry
LOCAL lcAccount_Site
LOCAL lcSstate
LOCAL lnSprocess_flow
LOCAL lnExchange_Rate
LOCAL lcBilling_Country
LOCAL lcV_Currency
LOCAL lcId
LOCAL lnSapproved
LOCAL lnDelegate
LOCAL lnApprove
LOCAL lnReject
LOCAL lnResubmit
LOCAL lcBilling_Street
LOCAL lcCreated_Time
LOCAL lnSeditable
LOCAL lcBilling_Code
LOCAL lcShipping_City
LOCAL lcShipping_Country
LOCAL lcShipping_Code
LOCAL lcBilling_City
LOCAL lcCreated_ByName
LOCAL lcCreated_ById
LOCAL lcCreated_ByEmail
LOCAL lnAnnual_Revenue
LOCAL lcShipping_Street
LOCAL lcTerritory_updated_time
LOCAL lcOwnership
LOCAL lcDescription
LOCAL lcRating
LOCAL lcShipping_State
LOCAL lnSreview_processApprove
LOCAL lnSreview_processReject
LOCAL lnSreview_processResubmit
LOCAL lcWebsite
LOCAL lcEmployees
LOCAL lcRecord_Image
LOCAL lcModified_ByName
LOCAL lcModified_ById
LOCAL lcModified_ByEmail
LOCAL lcSreview
LOCAL lcPhone
LOCAL lcAccount_Name
LOCAL lcAccount_Number
LOCAL lcTicker_Symbol
LOCAL lcModified_Time
LOCAL lnSorchestration
LOCAL lcParent_Account
LOCAL lnSin_merge
LOCAL lcBilling_State
LOCAL lcFax
LOCAL lcSapproval_state
LOCAL j
LOCAL lnCount_j
LOCAL lcStrVal
LOCAL lnPer_page
LOCAL lnCount
LOCAL lnPage
LOCAL lnMore_records
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://domain.com/crm/v2/Accounts",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "data": [
* {
* "Owner": {
* "name": "Patricia Boyle",
* "id": "738964000000291009",
* "email": "patricia.ss@zylker.com"
* },
* "$currency_symbol": "Af",
* "Account_Type": null,
* "SIC_Code": null,
* "Last_Activity_Time": "2021-05-07T06:19:49+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 Boyle",
* "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 Boyle",
* "id": "738964000000291009",
* "email": "patricia.ss@zylker.com"
* },
* "$review": null,
* "Phone": null,
* "Account_Name": "Villa Margarita",
* "Account_Number": "0",
* "Ticker_Symbol": null,
* "Modified_Time": "2021-05-07T06:19:48+00:00",
* "Territories": [
* "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
lnPer_page = loJResp.IntOf("info.per_page")
lnCount = loJResp.IntOf("info.count")
lnPage = loJResp.IntOf("info.page")
lnMore_records = loJResp.BoolOf("info.more_records")
i = 0
lnCount_i = loJResp.SizeOfArray("data")
DO WHILE i < lnCount_i
loJResp.I = i
lcName = loJResp.StringOf("data[i].Owner.name")
lcId = loJResp.StringOf("data[i].Owner.id")
lcV_Email = loJResp.StringOf("data[i].Owner.email")
lcScurrency_symbol = loJResp.StringOf("data[i].$currency_symbol")
lcAccount_Type = loJResp.StringOf("data[i].Account_Type")
lcSIC_Code = loJResp.StringOf("data[i].SIC_Code")
lcLast_Activity_Time = loJResp.StringOf("data[i].Last_Activity_Time")
lcIndustry = loJResp.StringOf("data[i].Industry")
lcAccount_Site = loJResp.StringOf("data[i].Account_Site")
lcSstate = loJResp.StringOf("data[i].$state")
lnSprocess_flow = loJResp.BoolOf("data[i].$process_flow")
lnExchange_Rate = loJResp.IntOf("data[i].Exchange_Rate")
lcBilling_Country = loJResp.StringOf("data[i].Billing_Country")
lcV_Currency = loJResp.StringOf("data[i].Currency")
lcId = loJResp.StringOf("data[i].id")
lnSapproved = loJResp.BoolOf("data[i].$approved")
lnDelegate = loJResp.BoolOf("data[i].$approval.delegate")
lnApprove = loJResp.BoolOf("data[i].$approval.approve")
lnReject = loJResp.BoolOf("data[i].$approval.reject")
lnResubmit = loJResp.BoolOf("data[i].$approval.resubmit")
lcBilling_Street = loJResp.StringOf("data[i].Billing_Street")
lcCreated_Time = loJResp.StringOf("data[i].Created_Time")
lnSeditable = loJResp.BoolOf("data[i].$editable")
lcBilling_Code = loJResp.StringOf("data[i].Billing_Code")
lcShipping_City = loJResp.StringOf("data[i].Shipping_City")
lcShipping_Country = loJResp.StringOf("data[i].Shipping_Country")
lcShipping_Code = loJResp.StringOf("data[i].Shipping_Code")
lcBilling_City = loJResp.StringOf("data[i].Billing_City")
lcCreated_ByName = loJResp.StringOf("data[i].Created_By.name")
lcCreated_ById = loJResp.StringOf("data[i].Created_By.id")
lcCreated_ByEmail = loJResp.StringOf("data[i].Created_By.email")
lnAnnual_Revenue = loJResp.IntOf("data[i].Annual_Revenue")
lcShipping_Street = loJResp.StringOf("data[i].Shipping_Street")
lcTerritory_updated_time = loJResp.StringOf("data[i].territory_updated_time")
lcOwnership = loJResp.StringOf("data[i].Ownership")
lcDescription = loJResp.StringOf("data[i].Description")
lcRating = loJResp.StringOf("data[i].Rating")
lcShipping_State = loJResp.StringOf("data[i].Shipping_State")
lnSreview_processApprove = loJResp.BoolOf("data[i].$review_process.approve")
lnSreview_processReject = loJResp.BoolOf("data[i].$review_process.reject")
lnSreview_processResubmit = loJResp.BoolOf("data[i].$review_process.resubmit")
lcWebsite = loJResp.StringOf("data[i].Website")
lcEmployees = loJResp.StringOf("data[i].Employees")
lcRecord_Image = loJResp.StringOf("data[i].Record_Image")
lcModified_ByName = loJResp.StringOf("data[i].Modified_By.name")
lcModified_ById = loJResp.StringOf("data[i].Modified_By.id")
lcModified_ByEmail = loJResp.StringOf("data[i].Modified_By.email")
lcSreview = loJResp.StringOf("data[i].$review")
lcPhone = loJResp.StringOf("data[i].Phone")
lcAccount_Name = loJResp.StringOf("data[i].Account_Name")
lcAccount_Number = loJResp.StringOf("data[i].Account_Number")
lcTicker_Symbol = loJResp.StringOf("data[i].Ticker_Symbol")
lcModified_Time = loJResp.StringOf("data[i].Modified_Time")
lnSorchestration = loJResp.BoolOf("data[i].$orchestration")
lcParent_Account = loJResp.StringOf("data[i].Parent_Account")
lnSin_merge = loJResp.BoolOf("data[i].$in_merge")
lcBilling_State = loJResp.StringOf("data[i].Billing_State")
lcFax = loJResp.StringOf("data[i].Fax")
lcSapproval_state = loJResp.StringOf("data[i].$approval_state")
j = 0
lnCount_j = loJResp.SizeOfArray("data[i].Territories")
DO WHILE j < lnCount_j
loJResp.J = j
lcStrVal = loJResp.StringOf("data[i].Territories[j]")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("data[i].Tag")
DO WHILE j < lnCount_j
loJResp.J = j
j = j + 1
ENDDO
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2/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/Accounts",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"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/Accounts?territory_id=738964000001977355",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Accounts"
],
"query": [
{
"key": "territory_id",
"value": "738964000001977355"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 12:37:14 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-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-11T12:57:36+00:00"
},
{
"key": "clientVersion",
"value": "4023320"
},
{
"key": "clientsubVersion",
"value": "4d8b6ee4f7d1d284c930a4e807480c5c"
},
{
"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 Boyle\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$currency_symbol\": \"Af\",\n \"Account_Type\": null,\n \"SIC_Code\": null,\n \"Last_Activity_Time\": \"2021-05-07T06:19:49+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 Boyle\",\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 Boyle\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$review\": null,\n \"Phone\": null,\n \"Account_Name\": \"Villa Margarita\",\n \"Account_Number\": \"0\",\n \"Ticker_Symbol\": null,\n \"Modified_Time\": \"2021-05-07T06:19:48+00:00\",\n \"Territories\": [\n \"South Zone\"\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/Accounts?territory_id=738964000001977355&include_child=true",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"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": "Tue, 11 May 2021 12:37:35 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-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-11T12:57:36+00:00"
},
{
"key": "clientVersion",
"value": "4023320"
},
{
"key": "clientsubVersion",
"value": "4d8b6ee4f7d1d284c930a4e807480c5c"
},
{
"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 Boyle\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$currency_symbol\": \"Af\",\n \"Account_Type\": null,\n \"SIC_Code\": null,\n \"Last_Activity_Time\": \"2021-05-07T06:19:49+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 Boyle\",\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 Boyle\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$review\": null,\n \"Phone\": null,\n \"Account_Name\": \"Villa Margarita\",\n \"Account_Number\": \"0\",\n \"Ticker_Symbol\": null,\n \"Modified_Time\": \"2021-05-07T06:19:48+00:00\",\n \"Territories\": [\n \"South Zone\"\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}"
}
]
}