Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
queryParams.i = CkJsonObject::ckCreate()
If queryParams.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(queryParams,"approvable-type","EasyFormResponse")
CkJsonObject::ckUpdateString(queryParams,"status[in]","pending_approval,approved")
CkJsonObject::ckUpdateString(queryParams,"approver-type","RemoteApprover")
CkJsonObject::ckUpdateInt(queryParams,"approver-id",1)
CkJsonObject::ckUpdateString(queryParams,"fields","[" + Chr(34) + "approvable_type" + Chr(34) + "," + Chr(34) + "approvable_id" + Chr(34) + "]")
; Adds the "Authorization: Bearer <access_token>" header.
CkHttp::setCkAuthToken(http, "<access_token>")
resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://domain.com/approvals",queryParams)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
ProcedureReturn
EndProcedure
Curl Command
curl -G -d "approvable-type=EasyFormResponse"
-d "status[in]=pending_approval,approved"
-d "approver-type=RemoteApprover"
-d "approver-id=1"
-d "fields=%5B%22approvable_type%22,%22approvable_id%22%5D"
-H "Authorization: Bearer <access_token>"
https://domain.com/approvals
Postman Collection Item JSON
{
"name": "Query Approval records",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{URL}}/approvals?approvable-type=EasyFormResponse&status[in]=pending_approval,approved&approver-type=RemoteApprover&approver-id=1&fields=[\"approvable_type\",\"approvable_id\"]",
"host": [
"{{URL}}"
],
"path": [
"approvals"
],
"query": [
{
"key": "approvable-type",
"value": "EasyFormResponse"
},
{
"key": "status[in]",
"value": "pending_approval,approved"
},
{
"key": "approver-type",
"value": "RemoteApprover"
},
{
"key": "approver-id",
"value": "1"
},
{
"key": "fields",
"value": "[\"approvable_type\",\"approvable_id\"]"
}
]
}
},
"response": [
]
}