Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://domain.com/crm/v2.1/Leads/{{record_id}}",$oSbResponseBody)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oHttp.LastHeader & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; 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"
; },
; "Company": null,
; "Email": null,
; "$currency_symbol": "Af",
; "Interested_Leads": [
; ],
; "Image123": null,
; "$sharing_permission": "full_access",
; "Image": null,
; "Last_Activity_Time": null,
; "Industry": null,
; "$state": "save",
; "Unsubscribed_Mode": null,
; "$converted": false,
; "$process_flow": false,
; "Exchange_Rate": 1,
; "Currency": "AFN",
; "Street": null,
; "Zip_Code": null,
; "multiuser": [
; ],
; "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": null,
; "State": null,
; "Country": null,
; "Created_By": {
; "name": "patricia patricia",
; "id": "738964000000291009",
; "email": "patricia.ss@zylker.com"
; },
; "Annual_Revenue": null,
; "Secondary_Email": null,
; "Description": null,
; "Rating": null,
; "$review_process": {
; "approve": false,
; "reject": false,
; "resubmit": false
; },
; "Website": null,
; "Twitter": null,
; "$canvas_id": null,
; "Salutation": null,
; "First_Name": null,
; "Lead_Status": null,
; "Full_Name": "sample",
; "Record_Image": null,
; "Modified_By": {
; "name": "patricia patricia",
; "id": "738964000000291009",
; "email": "patricia.ss@zylker.com"
; },
; "$review": null,
; "Lead_Conversion_Time": null,
; "Skype_ID": null,
; "Phone": null,
; "HIPAA": null,
; "Email_Opt_Out": false,
; "Designation": null,
; "Modified_Time": "2021-05-07T06:23:10+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",
; "$has_more": {
; "Interested_Leads": false,
; "multiuser": false
; }
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Local $sName
Local $sId
Local $sV_Email
Local $sCompany
Local $sScurrency_symbol
Local $sImage123
Local $sSsharing_permission
Local $sImage
Local $sLast_Activity_Time
Local $sIndustry
Local $sSstate
Local $sUnsubscribed_Mode
Local $bSconverted
Local $bSprocess_flow
Local $iExchange_Rate
Local $sV_Currency
Local $sStreet
Local $sZip_Code
Local $sData_Processing_Basis_Details
Local $sId
Local $sData_Source
Local $bSapproved
Local $bDelegate
Local $bApprove
Local $bReject
Local $bResubmit
Local $sSdata_source_details
Local $sCreated_Time
Local $bSeditable
Local $sCity
Local $sNo_of_Employees
Local $sState
Local $sCountry
Local $sCreated_ByName
Local $sCreated_ById
Local $sCreated_ByEmail
Local $sAnnual_Revenue
Local $sSecondary_Email
Local $sDescription
Local $sRating
Local $bSreview_processApprove
Local $bSreview_processReject
Local $bSreview_processResubmit
Local $sWebsite
Local $sTwitter
Local $sScanvas_id
Local $sSalutation
Local $sFirst_Name
Local $sLead_Status
Local $sFull_Name
Local $sRecord_Image
Local $sModified_ByName
Local $sModified_ById
Local $sModified_ByEmail
Local $sSreview
Local $sLead_Conversion_Time
Local $sSkype_ID
Local $sPhone
Local $sHIPAA
Local $bEmail_Opt_Out
Local $sDesignation
Local $sModified_Time
Local $sUnsubscribed_Time
Local $sMobile
Local $bSorchestration
Local $bSstop_processing
Local $sLast_Name
Local $bSin_merge
Local $sLead_Source
Local $sFax
Local $sSapproval_state
Local $bInterested_Leads
Local $bMultiuser
Local $iJ
Local $iCount_j
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("data")
While $i < $iCount_i
$oJResp.I = $i
$sName = $oJResp.StringOf("data[i].Owner.name")
$sId = $oJResp.StringOf("data[i].Owner.id")
$sV_Email = $oJResp.StringOf("data[i].Owner.email")
$sCompany = $oJResp.StringOf("data[i].Company")
$sV_Email = $oJResp.StringOf("data[i].Email")
$sScurrency_symbol = $oJResp.StringOf("data[i].$currency_symbol")
$sImage123 = $oJResp.StringOf("data[i].Image123")
$sSsharing_permission = $oJResp.StringOf("data[i].$sharing_permission")
$sImage = $oJResp.StringOf("data[i].Image")
$sLast_Activity_Time = $oJResp.StringOf("data[i].Last_Activity_Time")
$sIndustry = $oJResp.StringOf("data[i].Industry")
$sSstate = $oJResp.StringOf("data[i].$state")
$sUnsubscribed_Mode = $oJResp.StringOf("data[i].Unsubscribed_Mode")
$bSconverted = $oJResp.BoolOf("data[i].$converted")
$bSprocess_flow = $oJResp.BoolOf("data[i].$process_flow")
$iExchange_Rate = $oJResp.IntOf("data[i].Exchange_Rate")
$sV_Currency = $oJResp.StringOf("data[i].Currency")
$sStreet = $oJResp.StringOf("data[i].Street")
$sZip_Code = $oJResp.StringOf("data[i].Zip_Code")
$sData_Processing_Basis_Details = $oJResp.StringOf("data[i].Data_Processing_Basis_Details")
$sId = $oJResp.StringOf("data[i].id")
$sData_Source = $oJResp.StringOf("data[i].Data_Source")
$bSapproved = $oJResp.BoolOf("data[i].$approved")
$bDelegate = $oJResp.BoolOf("data[i].$approval.delegate")
$bApprove = $oJResp.BoolOf("data[i].$approval.approve")
$bReject = $oJResp.BoolOf("data[i].$approval.reject")
$bResubmit = $oJResp.BoolOf("data[i].$approval.resubmit")
$sSdata_source_details = $oJResp.StringOf("data[i].$data_source_details")
$sCreated_Time = $oJResp.StringOf("data[i].Created_Time")
$bSeditable = $oJResp.BoolOf("data[i].$editable")
$sCity = $oJResp.StringOf("data[i].City")
$sNo_of_Employees = $oJResp.StringOf("data[i].No_of_Employees")
$sState = $oJResp.StringOf("data[i].State")
$sCountry = $oJResp.StringOf("data[i].Country")
$sCreated_ByName = $oJResp.StringOf("data[i].Created_By.name")
$sCreated_ById = $oJResp.StringOf("data[i].Created_By.id")
$sCreated_ByEmail = $oJResp.StringOf("data[i].Created_By.email")
$sAnnual_Revenue = $oJResp.StringOf("data[i].Annual_Revenue")
$sSecondary_Email = $oJResp.StringOf("data[i].Secondary_Email")
$sDescription = $oJResp.StringOf("data[i].Description")
$sRating = $oJResp.StringOf("data[i].Rating")
$bSreview_processApprove = $oJResp.BoolOf("data[i].$review_process.approve")
$bSreview_processReject = $oJResp.BoolOf("data[i].$review_process.reject")
$bSreview_processResubmit = $oJResp.BoolOf("data[i].$review_process.resubmit")
$sWebsite = $oJResp.StringOf("data[i].Website")
$sTwitter = $oJResp.StringOf("data[i].Twitter")
$sScanvas_id = $oJResp.StringOf("data[i].$canvas_id")
$sSalutation = $oJResp.StringOf("data[i].Salutation")
$sFirst_Name = $oJResp.StringOf("data[i].First_Name")
$sLead_Status = $oJResp.StringOf("data[i].Lead_Status")
$sFull_Name = $oJResp.StringOf("data[i].Full_Name")
$sRecord_Image = $oJResp.StringOf("data[i].Record_Image")
$sModified_ByName = $oJResp.StringOf("data[i].Modified_By.name")
$sModified_ById = $oJResp.StringOf("data[i].Modified_By.id")
$sModified_ByEmail = $oJResp.StringOf("data[i].Modified_By.email")
$sSreview = $oJResp.StringOf("data[i].$review")
$sLead_Conversion_Time = $oJResp.StringOf("data[i].Lead_Conversion_Time")
$sSkype_ID = $oJResp.StringOf("data[i].Skype_ID")
$sPhone = $oJResp.StringOf("data[i].Phone")
$sHIPAA = $oJResp.StringOf("data[i].HIPAA")
$bEmail_Opt_Out = $oJResp.BoolOf("data[i].Email_Opt_Out")
$sDesignation = $oJResp.StringOf("data[i].Designation")
$sModified_Time = $oJResp.StringOf("data[i].Modified_Time")
$sUnsubscribed_Time = $oJResp.StringOf("data[i].Unsubscribed_Time")
$sMobile = $oJResp.StringOf("data[i].Mobile")
$bSorchestration = $oJResp.BoolOf("data[i].$orchestration")
$bSstop_processing = $oJResp.BoolOf("data[i].$stop_processing")
$sLast_Name = $oJResp.StringOf("data[i].Last_Name")
$bSin_merge = $oJResp.BoolOf("data[i].$in_merge")
$sLead_Source = $oJResp.StringOf("data[i].Lead_Source")
$sFax = $oJResp.StringOf("data[i].Fax")
$sSapproval_state = $oJResp.StringOf("data[i].$approval_state")
$bInterested_Leads = $oJResp.BoolOf("data[i].$has_more.Interested_Leads")
$bMultiuser = $oJResp.BoolOf("data[i].$has_more.multiuser")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("data[i].Interested_Leads")
While $iJ < $iCount_j
$oJResp.J = $iJ
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("data[i].multiuser")
While $iJ < $iCount_j
$oJResp.J = $iJ
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("data[i].Tag")
While $iJ < $iCount_j
$oJResp.J = $iJ
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2.1/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.1/Leads/{{record_id}}",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"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.1/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"738964000002131001"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Fri, 07 May 2021 06:32:59 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-07T06:44:53+00:00"
},
{
"key": "clientVersion",
"value": "4016256"
},
{
"key": "clientsubVersion",
"value": "8ef7aa3133ce0e105307c407d89b23d9"
},
{
"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 \"Company\": null,\n \"Email\": null,\n \"$currency_symbol\": \"Af\",\n \"Interested_Leads\": [],\n \"Image123\": null,\n \"$sharing_permission\": \"full_access\",\n \"Image\": null,\n \"Last_Activity_Time\": null,\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\": null,\n \"multiuser\": [],\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\": null,\n \"State\": null,\n \"Country\": null,\n \"Created_By\": {\n \"name\": \"patricia patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"Annual_Revenue\": null,\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\": null,\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 patricia\",\n \"id\": \"738964000000291009\",\n \"email\": \"patricia.ss@zylker.com\"\n },\n \"$review\": null,\n \"Lead_Conversion_Time\": null,\n \"Skype_ID\": null,\n \"Phone\": null,\n \"HIPAA\": null,\n \"Email_Opt_Out\": false,\n \"Designation\": null,\n \"Modified_Time\": \"2021-05-07T06:23:10+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 \"$has_more\": {\n \"Interested_Leads\": false,\n \"multiuser\": false\n }\n }\n ]\n}"
},
{
"name": "INVALID_MODULE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"738964000002131001"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Fri, 07 May 2021 06:33:30 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "133"
},
{
"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-07T06:44:53+00:00"
},
{
"key": "clientVersion",
"value": "4016256"
},
{
"key": "clientsubVersion",
"value": "8ef7aa3133ce0e105307c407d89b23d9"
},
{
"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 \"resource_path_index\": 0\n },\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.1/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"738964000002131001"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Fri, 07 May 2021 06:34:10 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.1/Leads/738964000002131001",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"738964000002131001"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Fri, 07 May 2021 06:34:28 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": "INVALID_REQUEST",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"{{record_id}}"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Thu, 13 May 2021 06:51:53 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "192"
},
{
"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\": \"INVALID_REQUEST\",\n \"details\": {},\n \"message\": \"unable to process your request. please verify whether you have entered proper method name, parameter and parameter values.\",\n \"status\": \"error\"\n}"
}
]
}