C++ / APPIA API / FETCH ESCROWS
Back to Collection Items
#include <CkHttp.h>
#include <CkJsonObject.h>
#include <CkStringBuilder.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http;
bool success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "trans_amount": 3000,
// "trans_name": "mobile phone",
// "details": "buying and selling"
// }
CkJsonObject json;
json.UpdateInt("trans_amount",3000);
json.UpdateString("trans_name","mobile phone");
json.UpdateString("details","buying and selling");
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkStringBuilder sbRequestBody;
json.EmitSb(sbRequestBody);
CkHttpResponse *resp = http.PTextSb("GET","https://domain.com/escrow/",sbRequestBody,"utf-8","application/json",false,false);
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
std::cout << resp->get_StatusCode() << "\r\n";
std::cout << resp->bodyStr() << "\r\n";
delete resp;
}
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-d '{
"trans_amount": 3000,
"trans_name": "mobile phone",
"details": "buying and selling"
}'
https://domain.com/escrow/
Postman Collection Item JSON
{
"name": "FETCH ESCROWS",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"trans_amount\": 3000,\n \"trans_name\": \"mobile phone\",\n \"details\": \"buying and selling\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/escrow/",
"host": [
"{{url}}"
],
"path": [
"escrow",
""
]
}
},
"response": [
]
}