Create a List [Beta]

Creates a Save for Later List with the given name and attributes.

🚧

Contact support for using Save for Later Beta APIs.

This document describes for creating a new save for later list for a shopper

Endpointrequest typeAPI Type
https://{{Swym API Endpoint }}/api/v3/lists/sfl/createPOSTshopper

Query Params

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

Form Data

FieldTypeRequiredDescription
lnamestringYesUnique name of the list to create
regidstringYesUnique identifier for the shopper generated by generate-regid
sessionidstringYesSession id generated with generate-regId endpoint which does not expire without manual intervention
user-agentstringYesUser-Agent header of the app used to access the API
lnotestringoptionalOptional note at list level
lpropsobjectoptionalList level object that can house custom properties
ldescstringoptionalList description

Example Curl

curl -X POST \
     --url '{{Swym API Endpoint }}/api/v3/lists/sfl/create?pid={{URL Encoded PID }}' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --header 'Accept: application/json' \
     --data-urlencode 'lname=My SFL list' \
     --data-urlencode 'sessionid={{sessionId}}' \
     --data-urlencode 'regid={{regid}}'\
     --data-urlencode 'user-agent={{user-agent}}'

🚧

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.

PlaceholdersDescriptions
{{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.
{{regid}}This needs to be replaced with the actual regid value.
{{sessionid}}This needs to be replaced with the actual session ID value.
{{user-agent}}This needs to be replaced with User-Agent header value.

Success Response

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

{
  "list": {
    "di": "27e0ff4a-e950-4057-aab0-e62fa0821c83", // Unique identifier for the device
    "lty": "sfl", // List type
    "uid": "eQfca8LNr0PeDPyEIb7Bz97FxkYqwbhcKMGVT5/rSHQ=", // Unique identifier for the user
    "cts": 1699666952352, // Creation timestamp (in milliseconds since epoch)
    "lnote": null, //List note
    "lname": "My SFL List", // List name
    "cby": "[email protected]", //Email of the user
    "lid": "0b2c578f-7583-4175-b0fe-db5fc31f4b7c", // Unique identifier for the list.
    "pid": "C7vi6wI9s9aa0jE3DY+e2J8R/45MnnDtXYF6xfGNlDQ=", // Unique identifier for the store
    "st": 1, // List status (1 = active, 0 = inactive)
    "cprops": {}, //Custom properties 
    "id": "bbf8fc3a-1c18-48fa-b8fc-3a1c1898fae9",
    "uts": 1699666952352, // Update timestamp (in milliseconds since epoch)
    "ldesc": {}, //List description
    "uby": "[email protected]", //Email of the user
    "cfor": "[email protected]" //Email of the user
  }
}

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.
500Internal Server ErrorWe had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.