Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// 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"
// }
// ]
// }
loJson = createobject("CkJsonObject")
loJson.UpdateString("processParameters[0].MemberId","0lMxx00000000BJEAY")
loJson.UpdateString("processParameters[0].VoucherId","0kdxx000000000B245")
// Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loResp = loHttp.PostJson3("https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName","application/json",loJson)
if (loHttp.LastMethodSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loJson
return
endif
? str(loResp.StatusCode)
? loResp.BodyStr
release loResp
release loHttp
release loJson
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": [
]
}