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": [
' {
' "MembershipNumber": "Member123",
' "PromotionId": "0c8J80000008OMhIAM"
' }
' ]
' }
Dim json As New Chilkat.JsonObject
json.UpdateString("processParameters[0].MembershipNumber","Member123")
json.UpdateString("processParameters[0].PromotionId","0c8J80000008OMhIAM")
' 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":[
{
"MembershipNumber":"Member123",
"PromotionId":"0c8J80000008OMhIAM"
}
]
}'
https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName
Postman Collection Item JSON
{
"name": "Enroll for Promotions",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"//pm.variables.set('loyaltyProgramName','xyz');",
"pm.variables.set('processName','EnrollInPromotion');"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"processParameters\":[\n {\n \"MembershipNumber\":\"Member123\",\n \"PromotionId\":\"0c8J80000008OMhIAM\"\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"
],
"query": [
{
"key": "journalTypeId",
"value": "",
"disabled": true
}
],
"variable": [
{
"key": "loyaltyProgramName",
"value": ""
},
{
"key": "processName",
"value": ""
}
]
},
"description": "[Enroll for Promotions](https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_enroll_ln_promotion.htm)\n\nNOTE:\n\nIn the Pre-request. Script Tab, make changes in the variables value accordingly with the real Process Name to invoke."
},
"response": [
{
"name": "example with a membership number",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"processParameters\":[\n {\n \"MembershipNumber\":\"M1234\",\n \"PromotionName\":\"Flat20\"\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"
],
"query": [
{
"key": "journalTypeId",
"value": null,
"disabled": true
}
],
"variable": [
{
"key": "loyaltyProgramName"
},
{
"key": "processName"
}
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [
],
"body": null
}
]
}