Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW queryParams;
HCkHttpResponseW resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
queryParams = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(queryParams,L"current_approver_association[login]",L"Test Approver Login");
CkJsonObjectW_UpdateString(queryParams,L"filter",L"default_invoices_filter");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttpW_putAuthToken(http,L"<access_token>");
resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://domain.com/invoices",queryParams);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(queryParams);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(queryParams);
}
Curl Command
curl -G -d "current_approver_association[login]=Test%20Approver%20Login"
-d "filter=default_invoices_filter"
-H "Authorization: Bearer <access_token>"
https://domain.com/invoices
Postman Collection Item JSON
{
"name": "Retrieve all invoices - Current Approver is User",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{URL}}/invoices?current_approver_association[login]=Test Approver Login&filter=default_invoices_filter",
"host": [
"{{URL}}"
],
"path": [
"invoices"
],
"query": [
{
"key": "current_approver_association[login]",
"value": "Test Approver Login"
},
{
"key": "filter",
"value": "default_invoices_filter"
}
]
}
},
"response": [
]
}