delphiAx / APPIA API / FETCH ESCROWS
Back to Collection Items
var
http: TChilkatHttp;
success: Integer;
json: TChilkatJsonObject;
sbRequestBody: TChilkatStringBuilder;
resp: IChilkatHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := TChilkatHttp.Create(Self);
// 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"
// }
json := TChilkatJsonObject.Create(Self);
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.AuthToken := '<access_token>';
sbRequestBody := TChilkatStringBuilder.Create(Self);
json.EmitSb(sbRequestBody.ControlInterface);
resp := http.PTextSb('GET','https://domain.com/escrow/',sbRequestBody.ControlInterface,'utf-8','application/json',0,0);
if (http.LastMethodSuccess = 0) then
begin
Memo1.Lines.Add(http.LastErrorText);
Exit;
end;
Memo1.Lines.Add(IntToStr(resp.StatusCode));
Memo1.Lines.Add(resp.BodyStr);
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": [
]
}