Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New Chilkat.Http
Dim success As Boolean
' 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"
' }
' ]
' }
Dim json As New Chilkat.JsonObject
json.UpdateString("processParameters[0].MemberId","0lMxx00000000BJEAY")
json.UpdateString("processParameters[0].VoucherId","0kdxx000000000B245")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
Dim resp As Chilkat.HttpResponse = http.PostJson3("https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName","application/json",json)
If (http.LastMethodSuccess = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If
Debug.WriteLine(resp.StatusCode)
Debug.WriteLine(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": [
]
}