Chilkat Online Tools

VB6 / Salesforce Platform APIs / Update Member Details

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 ChilkatHttp
Dim success As Long

' 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": "0lMRM0000004G5h2AE",
'       "MembershipNumber": "M1234",
'       "Email": "adam.smith@nto.com",
'       "EnrollmentDate": "2023-05-28",
'       "LastName": "Smith"
'     }
'   ]
' }

Dim json As New ChilkatJsonObject
success = json.UpdateString("processParameters[0].MemberId","0lMRM0000004G5h2AE")
success = json.UpdateString("processParameters[0].MembershipNumber","M1234")
success = json.UpdateString("processParameters[0].Email","adam.smith@nto.com")
success = json.UpdateString("processParameters[0].EnrollmentDate","2023-05-28")
success = json.UpdateString("processParameters[0].LastName","Smith")

' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"

Dim resp As ChilkatHttpResponse
Set resp = http.PostJson3("https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName","application/json",json)
If (http.LastMethodSuccess = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Debug.Print resp.StatusCode
Debug.Print resp.BodyStr

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
   "processParameters":[
      {
         "MemberId":"0lMRM0000004G5h2AE",
         "MembershipNumber":"M1234",
         "Email":"adam.smith@nto.com",
         "EnrollmentDate":"2023-05-28",
         "LastName":"Smith"
      }
   ]
}'
https://domain.com/services/data/v{{version}}/connect/loyalty/programs/:loyaltyProgramName/program-processes/:processName

Postman Collection Item JSON

{
  "name": "Update Member Details",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          "//pm.variables.set('loyaltyProgramName','xyz');",
          "pm.variables.set('processName','UpdateMemberDetails');"
        ],
        "type": "text/javascript",
        "packages": {}
      }
    }
  ],
  "request": {
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n   \"processParameters\":[\n      {\n         \"MemberId\":\"0lMRM0000004G5h2AE\",\n         \"MembershipNumber\":\"M1234\",\n         \"Email\":\"adam.smith@nto.com\",\n         \"EnrollmentDate\":\"2023-05-28\",\n         \"LastName\":\"Smith\"\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"
        },
        {
          "key": "processName"
        }
      ]
    },
    "description": "[Update Member Details](https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_update_member_details.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 member ID",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n   \"processParameters\":[\n      {\n         \"MemberId\":\"0lMRM0000004G5h2AE\",\n         \"MembershipNumber\":\"M1234\",\n         \"Email\":\"adam.smith@nto.com\",\n         \"EnrollmentDate\":\"2023-05-28\",\n         \"LastName\":\"Smith\"\n      }\n   ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://itab2c--devloyalty.sandbox.my.salesforce.com/services/data/v60.0/connect/loyalty/programs/Volare/program-processes/processName",
          "protocol": "https",
          "host": [
            "itab2c--devloyalty",
            "sandbox",
            "my",
            "salesforce",
            "com"
          ],
          "path": [
            "services",
            "data",
            "v60.0",
            "connect",
            "loyalty",
            "programs",
            "Volare",
            "program-processes",
            "processName"
          ],
          "query": [
            {
              "key": "journalTypeId",
              "value": null,
              "disabled": true
            }
          ]
        }
      },
      "_postman_previewlanguage": null,
      "header": null,
      "cookie": [
      ],
      "body": null
    },
    {
      "name": "example with a membership number",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{accessToken}}"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n   \"processParameters\":[\n      {\n         \"CurrentMembershipNumber\":\"M1234\",\n         \"MembershipNumber\":\"M1234\",\n         \"Email\":\"adam.smith@nto.com\",\n         \"EnrollmentDate\":\"2023-05-28\",\n         \"LastName\":\"Smith\"\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
    }
  ]
}