Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcName
LOCAL lcId
LOCAL lcV_Email
LOCAL lcCompany
LOCAL lcScurrency_symbol
LOCAL lcInterested_Leads
LOCAL lcLast_Activity_Time
LOCAL lcIndustry
LOCAL lcSstate
LOCAL lcUnsubscribed_Mode
LOCAL lnSconverted
LOCAL lnSprocess_flow
LOCAL lnExchange_Rate
LOCAL lcV_Currency
LOCAL lcStreet
LOCAL lcZip_Code
LOCAL lcData_Processing_Basis_Details
LOCAL lcId
LOCAL lcData_Source
LOCAL lnSapproved
LOCAL lnDelegate
LOCAL lnApprove
LOCAL lnReject
LOCAL lnResubmit
LOCAL lcSdata_source_details
LOCAL lcCreated_Time
LOCAL lnSeditable
LOCAL lcCity
LOCAL lnNo_of_Employees
LOCAL lcState
LOCAL lcCountry
LOCAL lcCreated_ByName
LOCAL lcCreated_ById
LOCAL lcCreated_ByEmail
LOCAL lnAnnual_Revenue
LOCAL lcSecondary_Email
LOCAL lcDescription
LOCAL lcRating
LOCAL lnSreview_processApprove
LOCAL lnSreview_processReject
LOCAL lnSreview_processResubmit
LOCAL lcWebsite
LOCAL lcTwitter
LOCAL lcScanvas_id
LOCAL lcSalutation
LOCAL lcFirst_Name
LOCAL lcLead_Status
LOCAL lcFull_Name
LOCAL lcRecord_Image
LOCAL lcModified_ByName
LOCAL lcModified_ById
LOCAL lcModified_ByEmail
LOCAL lcSreview
LOCAL lcSkype_ID
LOCAL lcPhone
LOCAL lcHIPAA
LOCAL lnEmail_Opt_Out
LOCAL lcDesignation
LOCAL lcModified_Time
LOCAL lcUnsubscribed_Time
LOCAL lcMobile
LOCAL lnSorchestration
LOCAL lnSstop_processing
LOCAL lcLast_Name
LOCAL lnSin_merge
LOCAL lcLead_Source
LOCAL lcFax
LOCAL lcSapproval_state
LOCAL j
LOCAL lnCount_j
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/Leads/{{record_id}}",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"
* },
* "Company": null,
* "Email": null,
* "$currency_symbol": "Af",
* "Interested_Leads": null,
* "Last_Activity_Time": "2021-05-07T13:10:11+00:00",
* "Industry": null,
* "$state": "save",
* "Unsubscribed_Mode": null,
* "$converted": false,
* "$process_flow": false,
* "Exchange_Rate": 1,
* "Currency": "AFN",
* "Street": null,
* "Zip_Code": "1234",
* "Data_Processing_Basis_Details": null,
* "id": "738964000002131001",
* "Data_Source": "Manual",
* "$approved": true,
* "$approval": {
* "delegate": false,
* "approve": false,
* "reject": false,
* "resubmit": false
* },
* "$data_source_details": null,
* "Created_Time": "2021-05-07T06:23:10+00:00",
* "$editable": true,
* "City": null,
* "No_of_Employees": 1000,
* "State": "Colorado",
* "Country": null,
* "Created_By": {
* "name": "Patricia Boyle",
* "id": "738964000000291009",
* "email": "patricia.ss@zylker.com"
* },
* "Annual_Revenue": 1,
* "Secondary_Email": null,
* "Description": null,
* "Rating": null,
* "$review_process": {
* "approve": false,
* "reject": false,
* "resubmit": false
* },
* "Website": "https://yaythisworked.com",
* "Twitter": null,
* "$canvas_id": null,
* "Salutation": null,
* "First_Name": null,
* "Lead_Status": null,
* "Full_Name": "sample",
* "Record_Image": null,
* "Modified_By": {
* "name": "Patricia Boyle",
* "id": "738964000000291009",
* "email": "patricia.ss@zylker.com"
* },
* "$review": null,
* "Skype_ID": null,
* "Phone": null,
* "HIPAA": null,
* "Email_Opt_Out": false,
* "Designation": null,
* "Modified_Time": "2021-05-07T13:10:11+00:00",
* "$converted_detail": {},
* "Unsubscribed_Time": null,
* "Mobile": "9898989898",
* "$orchestration": false,
* "$stop_processing": false,
* "Last_Name": "sample",
* "$in_merge": false,
* "Lead_Source": null,
* "Tag": [
* ],
* "Fax": null,
* "$approval_state": "approved"
* }
* ]
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
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")
lcCompany = loJResp.StringOf("data[i].Company")
lcV_Email = loJResp.StringOf("data[i].Email")
lcScurrency_symbol = loJResp.StringOf("data[i].$currency_symbol")
lcInterested_Leads = loJResp.StringOf("data[i].Interested_Leads")
lcLast_Activity_Time = loJResp.StringOf("data[i].Last_Activity_Time")
lcIndustry = loJResp.StringOf("data[i].Industry")
lcSstate = loJResp.StringOf("data[i].$state")
lcUnsubscribed_Mode = loJResp.StringOf("data[i].Unsubscribed_Mode")
lnSconverted = loJResp.BoolOf("data[i].$converted")
lnSprocess_flow = loJResp.BoolOf("data[i].$process_flow")
lnExchange_Rate = loJResp.IntOf("data[i].Exchange_Rate")
lcV_Currency = loJResp.StringOf("data[i].Currency")
lcStreet = loJResp.StringOf("data[i].Street")
lcZip_Code = loJResp.StringOf("data[i].Zip_Code")
lcData_Processing_Basis_Details = loJResp.StringOf("data[i].Data_Processing_Basis_Details")
lcId = loJResp.StringOf("data[i].id")
lcData_Source = loJResp.StringOf("data[i].Data_Source")
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")
lcSdata_source_details = loJResp.StringOf("data[i].$data_source_details")
lcCreated_Time = loJResp.StringOf("data[i].Created_Time")
lnSeditable = loJResp.BoolOf("data[i].$editable")
lcCity = loJResp.StringOf("data[i].City")
lnNo_of_Employees = loJResp.IntOf("data[i].No_of_Employees")
lcState = loJResp.StringOf("data[i].State")
lcCountry = loJResp.StringOf("data[i].Country")
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")
lcSecondary_Email = loJResp.StringOf("data[i].Secondary_Email")
lcDescription = loJResp.StringOf("data[i].Description")
lcRating = loJResp.StringOf("data[i].Rating")
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")
lcTwitter = loJResp.StringOf("data[i].Twitter")
lcScanvas_id = loJResp.StringOf("data[i].$canvas_id")
lcSalutation = loJResp.StringOf("data[i].Salutation")
lcFirst_Name = loJResp.StringOf("data[i].First_Name")
lcLead_Status = loJResp.StringOf("data[i].Lead_Status")
lcFull_Name = loJResp.StringOf("data[i].Full_Name")
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")
lcSkype_ID = loJResp.StringOf("data[i].Skype_ID")
lcPhone = loJResp.StringOf("data[i].Phone")
lcHIPAA = loJResp.StringOf("data[i].HIPAA")
lnEmail_Opt_Out = loJResp.BoolOf("data[i].Email_Opt_Out")
lcDesignation = loJResp.StringOf("data[i].Designation")
lcModified_Time = loJResp.StringOf("data[i].Modified_Time")
lcUnsubscribed_Time = loJResp.StringOf("data[i].Unsubscribed_Time")
lcMobile = loJResp.StringOf("data[i].Mobile")
lnSorchestration = loJResp.BoolOf("data[i].$orchestration")
lnSstop_processing = loJResp.BoolOf("data[i].$stop_processing")
lcLast_Name = loJResp.StringOf("data[i].Last_Name")
lnSin_merge = loJResp.BoolOf("data[i].$in_merge")
lcLead_Source = loJResp.StringOf("data[i].Lead_Source")
lcFax = loJResp.StringOf("data[i].Fax")
lcSapproval_state = loJResp.StringOf("data[i].$approval_state")
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/Leads/{{record_id}}
Postman Collection Item JSON
{
"name": "Subforms",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Leads/{{record_id}}",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Leads",
"{{record_id}}"
]
},
"description": "To get the subform data in a record."
},
"response": [
{
"name": "SUCCESS RESPONSE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Leads",
"738964000002131001"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 13:16:36 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-11T13:58:39+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 \"Company\": null,\n \"Email\": null,\n \"$currency_symbol\": \"Af\",\n \"Interested_Leads\": null,\n \"Last_Activity_Time\": \"2021-05-07T13:10:11+00:00\",\n \"Industry\": null,\n \"$state\": \"save\",\n \"Unsubscribed_Mode\": null,\n \"$converted\": false,\n \"$process_flow\": false,\n \"Exchange_Rate\": 1,\n \"Currency\": \"AFN\",\n \"Street\": null,\n \"Zip_Code\": \"1234\",\n \"Data_Processing_Basis_Details\": null,\n \"id\": \"738964000002131001\",\n \"Data_Source\": \"Manual\",\n \"$approved\": true,\n \"$approval\": {\n \"delegate\": false,\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"$data_source_details\": null,\n \"Created_Time\": \"2021-05-07T06:23:10+00:00\",\n \"$editable\": true,\n \"City\": null,\n \"No_of_Employees\": 1000,\n \"State\": \"Colorado\",\n \"Country\": null,\n \"Created_By\": {\n \"name\": \"Patricia Boyle\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"Annual_Revenue\": 1,\n \"Secondary_Email\": null,\n \"Description\": null,\n \"Rating\": null,\n \"$review_process\": {\n \"approve\": false,\n \"reject\": false,\n \"resubmit\": false\n },\n \"Website\": \"https://yaythisworked.com\",\n \"Twitter\": null,\n \"$canvas_id\": null,\n \"Salutation\": null,\n \"First_Name\": null,\n \"Lead_Status\": null,\n \"Full_Name\": \"sample\",\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 \"Skype_ID\": null,\n \"Phone\": null,\n \"HIPAA\": null,\n \"Email_Opt_Out\": false,\n \"Designation\": null,\n \"Modified_Time\": \"2021-05-07T13:10:11+00:00\",\n \"$converted_detail\": {},\n \"Unsubscribed_Time\": null,\n \"Mobile\": \"9898989898\",\n \"$orchestration\": false,\n \"$stop_processing\": false,\n \"Last_Name\": \"sample\",\n \"$in_merge\": false,\n \"Lead_Source\": null,\n \"Tag\": [],\n \"Fax\": null,\n \"$approval_state\": \"approved\"\n }\n ]\n}"
},
{
"name": "INVALID_MODULE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Lead/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Lead",
"738964000002131001"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 13:16:54 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "110"
},
{
"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-11T13:58:39+00:00"
},
{
"key": "clientVersion",
"value": "4023320"
},
{
"key": "clientsubVersion",
"value": "4d8b6ee4f7d1d284c930a4e807480c5c"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_MODULE\",\n \"details\": {},\n \"message\": \"the module name given seems to be invalid\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_REQUEST_METHOD",
"originalRequest": {
"method": "COPY",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Leads",
"738964000002131001"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 13:17:14 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "124"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Frame-Options",
"value": "deny"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_REQUEST_METHOD\",\n \"details\": {},\n \"message\": \"The http request method type is not a valid one\",\n \"status\": \"error\"\n}"
},
{
"name": "AUTHENTICATION_FAILURE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Leads",
"738964000002131001"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 13:17:33 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "98"
},
{
"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-Download-Options",
"value": "noopen"
}
],
"cookie": [
],
"body": "{\n \"code\": \"AUTHENTICATION_FAILURE\",\n \"details\": {},\n \"message\": \"Authentication failed\",\n \"status\": \"error\"\n}"
},
{
"name": "OAUTH_SCOPE_MISMATCH",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Leads/{{record_id}}",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Leads",
"{{record_id}}"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Thu, 13 May 2021 06:35:48 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "113"
},
{
"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-Download-Options",
"value": "noopen"
}
],
"cookie": [
],
"body": "{\n \"code\": \"OAUTH_SCOPE_MISMATCH\",\n \"details\": {},\n \"message\": \"invalid oauth scope to access this URL\",\n \"status\": \"error\"\n}"
}
]
}