Create a List
Creates a new List with the given name and attributes.
This document describes for creating a new list for a shopper
Endpoint | request type | API Type |
---|---|---|
https://{{Swym API Endpoint }}/api/v3/lists/create | POST | shopper |
Headers:
Header | Required | Description |
---|---|---|
user-agent | Yes | User-Agent header of the app used to access the API |
Query Params
Parameter | Type | Required | Description |
---|---|---|---|
pid | string (Encoded) | Yes | Unique identifier for the store available in Swym Admin |
limit | int64 | No | Maximum number of records to return |
offset | int64 | No | Number of records to skip |
Form Data
Field | Type | Required | Description |
---|---|---|---|
lname | string | Yes | Unique name of the list to create |
regid | string | Yes | Unique identifier for the shopper generated by generate-regid |
sessionid | string | Yes | Session id generated with generate-regId endpoint which does not expire without manual intervention |
lnote | string | optional | Optional note at list level |
lty | string | optional | Optional list type |
lprops | object | optional | List level object that can house custom properties |
fromlid | string | optional | Unique identifier of the list to duplicate from |
ldesc | string | optional | List description |
Example Curl
curl -X POST \
--url '{{Swym API Endpoint }}/api/v3/lists/create?pid={{URL Encoded PID }}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'user-agent: mobileApp' \
--data-urlencode 'lname=My test list' \
--data-urlencode 'sessionid={{sessionId}}' \
--data-urlencode 'regid={{regid}}'
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.
Placeholders | Descriptions |
---|---|
{{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. |
{{lid}} | This needs to be replaced with the actual list ID value. |
Success Response
The below responses are what you would get based on being logged in or an authenticated user.
{
"di": "Z+/ywr3MW/NoY3W2jnNN5GRWUm9Ye/4/7DlUMYWCh60=-API", // Unique identifier for the device
"userinfo": null, // User information associated with the list (not present in this example)
"lty": "wl", // List type
"cts": 1681110226853, // Creation timestamp (in milliseconds since epoch)
"lname": "My test list", // List name
"lid": "95cd0bcb-585f-436b-9141-dfa922ebf80c", // Unique identifier for the list.
"pid": "1f0WvUYRaFyM6/cno5z1H2oAYI7tbUWbcGA1kY=", // Unique identifier for the store
"st": 1, // List status (1 = active, 0 = inactive)
"uts": 1681110226853, // Last update timestamp (in milliseconds since epoch)
"lhash": "bXktdGVzdC1saXN0" // Base64-encoded hash of the list name and attributes
}
{
"di": "91b43457-b092-46ca-bd6c-91ecc2f04dd5", // Unique Device Identifier tied to email
"userinfo": {
"sw_mkt": null, // Marketing Permissions True would mean subscribed.
"uid": "uH7nZUNswsC6ejml9x7cZqDb1xgCMEqgds7jk+GIfrg=", user id
"em": "[email protected]", email address
"cts": 1681408172605,
"pid": "1f0WvUYRaFyM6/cno5z1H2oAYI7tbU76VY=", // Unique Merchant ID
"uts": 1681408172605, List created time stamp
"acc_mkt": null, // Accept marketing - Same as sw_mkt however this is platform dependent
"prefs": null // user preferences.
},
"lty": "wl", // List type
"uid": "uH7nZUNswsC6ejml9x7cZqDb1xgCMEqgds7jk+GIfrg=", // UID
"cts": 1681408180376, // List Created Time stamp
"lname": "My test list", // List name
"cby": "[email protected]", // Example email address
"lid": "f3c4a7bd-1fb7-4c85-8df9-73d1de186cfe", // List ID
"pid": "1f0WvUYRaFyM6/cno5z1H2oA1kY=", // Unique Merchant ID
"uts": 1681408180376, // User time stamp.
"_pkey": "uH7nZUNs",
"uby": "[email protected]", // List created by email.
"cfor": "[email protected]" // List Created For Email
}
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 Code | Type | Description |
---|---|---|
400 | Bad Request | Your request is invalid, change your request params and query and try again. |
401 | Unauthorised | You 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. |
403 | Forbidden | You are not allowed to request this data. |
404 | Not Found | The specified requested data could not be found. |
429 | Too Many Requests | You're raising too many requests! Slow down! |
500 | Internal Server Error -- | We had a problem with our server. Try again later. |
503 | Service Unavailable | We're temporarily offline for maintenance. Please try again later. |
Updated over 1 year ago