Smart Wishlist REST API

Our REST API is a fully functional API, which allows developers to integrate wishlist features into other applications such as desktop apps, mobile apps and web apps. It is authenticated and secure. It is meant for backend programming only. If you need to integrate wishlist into the online store/theme, consider using Public API instead.

NOTE: The API is currently in beta. Therefore we shall onboard limited number of store owners. If you are willing to join the program, please contact us. There is no additional cost for using the API

Endpoints

https://www.yourstore.com/a/wishlist?type=api
https://your-store.myshopify.com/a/wishlist?type=api

The endpoints for REST API on your store is the Wishlist page URL, appended by ?type=api. Both myshopify domain and custom domains are supported. If you have changed the wishlist path to /tools/mywishlist then the endpoints would also get changed. The new endpoints shall be:

https://www.yourstore.com/tools/mywishlist?type=api
https://your-store.myshopify.com/tools/mywishlist?type=api

REQUEST VARIABLES

namedetailsVALUE Typemandatory
productidThe numeric id of the product generated by ShopifyNumberYes
variantidThe numeric id of the product variant generated by Shopify. If no variant information available, use the first variant.NumberYes
customeridThe numeric id of the user generated by ShopifyNumberYes
actionValid values are:

“add” : add the item to wishlist
“remove”: remove the item from wishlist
StringYes
apikeyThe API key provided by Smart Wishlist for authentication. It should not be confused with any API keys provided by Shopify.StringYes
versionAPI version number. Currently the only valid value is 1.StringYes

RESPONSE VARIABLES

All the response is formatted in JSON

NameDETAILSvalue type
typeIndicates whether the request failed or succeeded. This should be used primarily in the logic for evaluating the response.

Valid values are:

1. “success”: request successful
2. “error”: request failed
String
messageA detailed description of the responseString
codeA numeric code for identifying what exactly happened while executing the request. Typically successful requests return 2xx and failed requests return 4xx. Intended for futuristic use. Number
shopifyresponsecodeThe response code returned by shopify if the app makes a request to Shopify API while processing the original request. A value of 0 indicates that no calls to Shopify was made.Number
versionAPI version number. Currently 1String

METHODS

1. Add an item to Wishlist

REQUEST

POST https://www.yourstore.com/a/wishlist?type=api

{
	"productid": 4653337542742,
	"variantid": 32315504492630,
	"customerid": 6154293388,
	"action": "add",
	"apikey": "your-smartwishlist-rest-api-key",
	"version": "1"  	
}


RESPONSE

{
    "type": "success",
    "code": 201,
    "shopifyresponsecode": 0,
    "version": "1",
    "message": "Item added to Wishlist"
}

2. Remove an item from Wishlist

REQUEST

POST https://www.yourstore.com/a/wishlist?type=api

{
	"productid": 4653337542742,
	"variantid": 32315504492630,
	"customerid": 6154293388,
	"action": "remove",
	"apikey": "your-smartwishlist-rest-api-key",
	"version": "1"  	
}

RESPONSE

{
    "type": "success",
    "code": 203,
    "shopifyresponsecode": 0,
    "version": "1",
    "message": "Item removed from Wishlist"
}

Important: While making the API calls, the request variables should be part of the body of the request. A frequent mistake developers make is sending the variables as headers. A typical call made via Postman is given below for reference.

3. View/Retrieve/Read the Wishlist

For viewing the items present in the wishlist, it is recommended to use the Public API. It follows a slightly different response syntax, but can be integrated into any application just like REST API.

Leave a Reply

Your email address will not be published. Required fields are marked *