Save Shopper Context [Beta]

Save Shopper Preferences

This API describes for saving shopper preferences

Endpointrequest typeAPI Type
https://{{Swym API Endpoint}}/api/v3/user/savePOSTshopper


user-agentYesUser-Agent header of the app used to access the API
originYesOrigin used to access the API

Query Params

pidstring (Encoded)YesUnique identifier for the store available in Swym Admin

Form Data

regidstringYesUnique identifier for the shopper generated by generate-regid
sessionidstringYesSession id generated with generate-regId endpoint which does not expire without manual intervention
languagestringYesLanguage of the shopper locale ex - en
regionstringYesRegion of the shopper locale ex - gb
fnamestringoptionalFirst name of the shopper
lnamestringoptionalLast name of the shopper
acceptMarketingbooleanoptionalPreference to receive marketing notifications - true or false

Example Curl

curl -X POST \
     --url '{{Swym API Endpoint}}/api/v3/user/save?pid={{URL Encoded PID }}' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --header 'Accept: application/json' \
     --header 'user-agent: mobileApp' \
     --header 'origin: {{storeurl}}' \
     --data-urlencode 'sessionid={{sessionId}}' \
     --data-urlencode 'regid={{regid}}' \
     --data-urlencode 'language=en' \
     --data-urlencode 'region=fr' \
     --data-urlencode 'fname=Swym Test User' \
     --data-urlencode 'lname=Last Name' \
     --data-urlencode 'acceptMarketing=true'


Curl Placeholders

Assuming these values are provided above, the curl command should work correctly. However, if there are any issues with the API endpoint or the data being passed in the request, there could still be errors that need to be resolved before you can test these APIS.

{{Swym API Endpoint}}This needs to be replaced with the actual Swym API endpoint URL.
{{URL Encoded PID}}This needs to be replaced with the actual PID value, URL-encoded.
{{storeurl}}This needs to be replaced with the actual storeurl.
{{regid}}This needs to be replaced with the actual regid value.
{{sessionid}}This needs to be replaced with the actual session ID value.

Success Response

The below responses are what you would get based on being logged in or an authenticated user.

  "fname": "Test User",
  "uid": "scPcCfdKIdvHvkDbqCimKt97byND/JALDMCYSt5GnAI=",
  "em": "[email protected]",
  "lname": "Support",
  "pid": "E1hoZtFhNOlsZc8cZRXlKrVr1PIANUAP87ESUbBUnJg=",
  "acc_mkt": true,
  "prefs": {
    "Mediums": {},
    "Locale": {
      "language": "en",
      "region": "fr"
  "message": "The user's preferences were saved successfully."

Error Response:

If the request is unsuccessful, the API will return a JSON response with an error message and an HTTP status code indicating the type of error that occurred.

Status CodeTypeDescription
400Bad RequestYour request is invalid, change your request params and query and try again.
401UnauthorisedYou are performing an action on a resource that is not granted to the current logged-in user. Additionally, for REST APIs, this could mean your API key is wrong.
403ForbiddenYou are not allowed to request this data.
404Not FoundThe specified requested data could not be found.
429Too Many RequestsYou're raising too many requests! Slow down!
500Internal Server Error --We had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.