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 sCompany
String sScurrency_symbol
String sInterested_Leads
String sLast_Activity_Time
String sIndustry
String sSstate
String sUnsubscribed_Mode
Boolean iSconverted
Boolean iSprocess_flow
Integer iExchange_Rate
String sV_Currency
String sStreet
String sZip_Code
String sData_Processing_Basis_Details
String sId
String sData_Source
Boolean iSapproved
Boolean iDelegate
Boolean iApprove
Boolean iReject
Boolean iResubmit
String sSdata_source_details
String sCreated_Time
Boolean iSeditable
String sCity
Integer iNo_of_Employees
String sState
String sCountry
String sCreated_ByName
String sCreated_ById
String sCreated_ByEmail
Integer iAnnual_Revenue
String sSecondary_Email
String sDescription
String sRating
Boolean iSreview_processApprove
Boolean iSreview_processReject
Boolean iSreview_processResubmit
String sWebsite
String sTwitter
String sScanvas_id
String sSalutation
String sFirst_Name
String sLead_Status
String sFull_Name
String sRecord_Image
String sModified_ByName
String sModified_ById
String sModified_ByEmail
String sSreview
String sSkype_ID
String sPhone
String sHIPAA
Boolean iEmail_Opt_Out
String sDesignation
String sModified_Time
String sUnsubscribed_Time
String sMobile
Boolean iSorchestration
Boolean iSstop_processing
String sLast_Name
Boolean iSin_merge
String sLead_Source
String sFax
String sSapproval_state
Integer j
Integer iCount_j
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/Leads/{{record_id}}" 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 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
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].Company" To sCompany
Get ComStringOf Of hoJResp "data[i].Email" To sV_Email
Get ComStringOf Of hoJResp "data[i].$currency_symbol" To sScurrency_symbol
Get ComStringOf Of hoJResp "data[i].Interested_Leads" To sInterested_Leads
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].$state" To sSstate
Get ComStringOf Of hoJResp "data[i].Unsubscribed_Mode" To sUnsubscribed_Mode
Get ComBoolOf Of hoJResp "data[i].$converted" To iSconverted
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].Currency" To sV_Currency
Get ComStringOf Of hoJResp "data[i].Street" To sStreet
Get ComStringOf Of hoJResp "data[i].Zip_Code" To sZip_Code
Get ComStringOf Of hoJResp "data[i].Data_Processing_Basis_Details" To sData_Processing_Basis_Details
Get ComStringOf Of hoJResp "data[i].id" To sId
Get ComStringOf Of hoJResp "data[i].Data_Source" To sData_Source
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].$data_source_details" To sSdata_source_details
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].City" To sCity
Get ComIntOf Of hoJResp "data[i].No_of_Employees" To iNo_of_Employees
Get ComStringOf Of hoJResp "data[i].State" To sState
Get ComStringOf Of hoJResp "data[i].Country" To sCountry
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].Secondary_Email" To sSecondary_Email
Get ComStringOf Of hoJResp "data[i].Description" To sDescription
Get ComStringOf Of hoJResp "data[i].Rating" To sRating
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].Twitter" To sTwitter
Get ComStringOf Of hoJResp "data[i].$canvas_id" To sScanvas_id
Get ComStringOf Of hoJResp "data[i].Salutation" To sSalutation
Get ComStringOf Of hoJResp "data[i].First_Name" To sFirst_Name
Get ComStringOf Of hoJResp "data[i].Lead_Status" To sLead_Status
Get ComStringOf Of hoJResp "data[i].Full_Name" To sFull_Name
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].Skype_ID" To sSkype_ID
Get ComStringOf Of hoJResp "data[i].Phone" To sPhone
Get ComStringOf Of hoJResp "data[i].HIPAA" To sHIPAA
Get ComBoolOf Of hoJResp "data[i].Email_Opt_Out" To iEmail_Opt_Out
Get ComStringOf Of hoJResp "data[i].Designation" To sDesignation
Get ComStringOf Of hoJResp "data[i].Modified_Time" To sModified_Time
Get ComStringOf Of hoJResp "data[i].Unsubscribed_Time" To sUnsubscribed_Time
Get ComStringOf Of hoJResp "data[i].Mobile" To sMobile
Get ComBoolOf Of hoJResp "data[i].$orchestration" To iSorchestration
Get ComBoolOf Of hoJResp "data[i].$stop_processing" To iSstop_processing
Get ComStringOf Of hoJResp "data[i].Last_Name" To sLast_Name
Get ComBoolOf Of hoJResp "data[i].$in_merge" To iSin_merge
Get ComStringOf Of hoJResp "data[i].Lead_Source" To sLead_Source
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].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/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}"
}
]
}