Back to Collection Items
var
http: TChilkatHttp;
success: Integer;
json: TChilkatJsonObject;
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.
// {
// "processParameters": [
// {
// "MemberId": "0lMxx00000000BJEAY",
// "VoucherId": "0kdxx000000000B245"
// }
// ]
// }
json := TChilkatJsonObject.Create(Self);
json.UpdateString('processParameters[0].MemberId','0lMxx00000000BJEAY');
json.UpdateString('processParameters[0].VoucherId','0kdxx000000000B245');
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken := '<access_token>';
resp := http.PostJson3('https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName','application/json',json.ControlInterface);
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 POST
-H "Authorization: Bearer <access_token>"
-d '{
"processParameters":[
{
"MemberId":"0lMxx00000000BJEAY",
"VoucherId":"0kdxx000000000B245"
}
]
}'
https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName
Postman Collection Item JSON
{
"name": "Cancel a Voucher",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"//pm.variables.set('loyaltyProgramName','xyz');",
"pm.variables.set('processName','CancelVoucher');"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"processParameters\":[\n {\n \"MemberId\":\"0lMxx00000000BJEAY\",\n \"VoucherId\":\"0kdxx000000000B245\"\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"loyalty",
"programs",
":loyaltyProgramName",
"program-processes",
":processName"
],
"variable": [
{
"key": "loyaltyProgramName",
"value": "NTO Insider"
},
{
"key": "processName",
"value": ""
}
]
},
"description": "Standard Documentation:\n\n[https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_cancel_voucher.htm](https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_cancel_voucher.htm)\n\nIn the Pre-request. Script Tab, make changes in the variables value accordingly with the real Process Name to invoke."
},
"response": [
]
}