Syncing Products

Use product sync APIs to sync the product and inventory of your store with Growlytics. This article will give you all the details you need to create products, collections and map products to collections.

Data Structure Of Product And Collections

The data structure of products and collections is many to many kinds of relationships. One collection can have multiple products and one product can be in multiple collections.

post
Add/Update Products

https://dc.growlytics.in /product
Using /product API, you can add products to Growlytics. If a product not found with the given id, it will be created, else it will be updated.
Request
Response
Request
Headers
x-growlytics-key
required
Growlytics API Key
Body Parameters
id
required
string
Product id. Your system's unique product id. Max 50 chars allowed.
name
required
string
Product name. Max 2000 chars allowed.
image
required
string
Product Image url. Max 1000 characters allowed.
description
optional
string
Product description. Max 2000 characters allowed. Null and empty values are alo allowed.
url
required
string
Url of the product. Max 1000 characters allowed.
price
required
number
Price of the product. Decimals are also allowed. Example: 12.20, 1321, 15.5
originalHigherPrice
optional
number
Product price without discount. Decimals are also allowed. Provide this field to show discounts in the campaign messages.
vendor
optional
string
Vendor of the product. Max 1000 characters allowed.
status
required
string
Inventory status of the product. Allowed values are inStock and outOfStock
Response
200: OK
Product synced successfully.
{ success: true }
422: Unprocessable Entity
Invalid input.
{
"type": "ValidationError",
"details": [
{
"message": "status must be one of [inStock, outOfStock]",
"path": [
"status"
],
"type": "any.allowOnly",
"context": {
"value": "1outOfStock",
"valids": [
"inStock",
"outOfStock"
],
"key": "status",
"label": "status"
}
}
]
}

delete
Remove Product

https://dc.growlytics.in/product/:id
Use this API to delete products from Growlytics's product dataset.
Request
Response
Request
Path Parameters
id
required
string
Product Id. Your system's product Id. Max 50 characters allowed.
Headers
x-growlytics-key
required
string
Growlytics API Key
Response
200: OK
Product deleted successfully.
{ success: true }

post
Add/Update Collection

https://dc.growlytics.in/collection
Using /collection API, you can add or update collection in the Growlytics collection dataset. If a collection does not exist for given id, it will be created, else it will be updated.
Request
Response
Request
Headers
x-growlytics-key
required
string
Growlytics API Key
Body Parameters
id
required
string
Collection Id. Your system's unique collection id. Max 50 chars allowed.
name
required
string
Collection name. Max 2000 characters allowed.
image
optional
string
url
required
string
Response
200: OK
{ success: true }
422: Unprocessable Entity
{
"type": "ValidationError",
"details": [
{
"message": "status must be one of [inStock, outOfStock]",
"path": [
"status"
],
"type": "any.allowOnly",
"context": {
"value": "1outOfStock",
"valids": [
"inStock",
"outOfStock"
],
"key": "status",
"label": "status"
}
}
]
}

delete
Delete Collection

https://dc.growlytics.in/collection/:id
Use this api to delete collection from Growlytics collection dataset. You will need to pass the id of the collection in url.
Request
Response
Request
Path Parameters
id
required
string
Id of the collection to be removed. Your system's collection id.
Headers
x-growlytics-key
required
string
Growlytics API Key.
Response
200: OK
{ success: true }

Mapping Products & Collections

Products and Collections have many to many relationships. You can use APIs to add or remove multiple products from a particular collection.

post
Add products to the collection

https://dc.growlytics.in/collection/:id/products/add
Use this API to add multiple products to the collection. You will need to pass the collection id in the URL.
Request
Response
Request
Path Parameters
id
required
string
Collection id. Your system's collection id.
Body Parameters
products
required
array
Array of string. List of product ids. Example: ['produc id 1', 'product id 2']
Response
200: OK
{ success: true }
422: Unprocessable Entity
{
"type": "ValidationError",
"details": [
{
"message": "status must be one of [inStock, outOfStock]",
"path": [
"status"
],
"type": "any.allowOnly",
"context": {
"value": "1outOfStock",
"valids": [
"inStock",
"outOfStock"
],
"key": "status",
"label": "status"
}
}
]
}

Make sure you have added products and collections in Growlytics before adding them to any collection. In short, products and collections to be mapped must exist in Growlytics.

post
Remove products from the collection

https://dc.growlytics.in/collection/:id/products/remove
Use this API to remove multiple products from a particular collection. You will need to pass the collection id in the URL.
Request
Response
Request
Path Parameters
id
required
string
Collection id. Your system's collection id.
Body Parameters
products
required
array
Array of string. List of product ids. Example: ['pid 1', 'pid 2']
Response
200: OK
{ success: true }
422: Unprocessable Entity
{
"type": "ValidationError",
"details": [
{
"message": "status must be one of [inStock, outOfStock]",
"path": [
"status"
],
"type": "any.allowOnly",
"context": {
"value": "1outOfStock",
"valids": [
"inStock",
"outOfStock"
],
"key": "status",
"label": "status"
}
}
]
}