Add or edit products in bulk
POST REST API request that requires a JSON body with authorization token in order to acquire, add or edit desired products.
In order for a product to be linked with a merchant, it requires an EAN that needs to be sent alongside desired changed data for that product.
Required fields for successful request are name, description, coverImage, EAN, but this will be subject to change during later iterations.
Request
Request:HTTP Method | POST | |||||
URL | Stage | https://api.stage.ananastest.com/product/api/v1/merchant-integration/import | ||||
Production | https://api.ananas.rs/product/api/v1/merchant-integration/import | |||||
HTTP Headers |
|
Fields name | Type | Description | Required |
name | String | Product name | Add: yes Edit: yes |
description | String | Product description (allows html tags, <br>,<ul>,<ol>,<li> excluding <b> or <i>) | Add: yes Edit: yes |
coverImage | String | Product cover image | Add: yes Edit: yes |
ean | String | European Article Number | Add: yes Edit: yes |
brand | String | Product brand | Add: yes Edit: no |
gallery | List<String> | Product images | Add: yes Edit: no |
parentEan | String | The product will be a variation of the product to which the EAN is entered | Add: no Edit: no |
packageWeightValue | BigDecimal/Double | Package weight of product | Add: yes Edit: no |
packageWeightUnit | String | Product weight package unit | Add: yes Edit: no |
basePrice | BigDecimal/Double | Product price with VAT included | Add: yes Edit: no |
vat | BigDecimal/Double | Product VAT | Add: yes Edit: no |
stockLevel | Integer | Product available stock level | Add: yes Edit: no |
sku | String | Stock keeping unit | Add: yes Edit: no |
externalId | String | Unique product identifier on merchant side | Add: no Edit: no |
productType | String | Type of product | Add: no Edit: no |
category | String | Main category where product belongs | Add: no Edit: no |
attributes | Map<String,List<String>> | Attributes of product like color, size, material type, number of HDMI’s, type of RAM, etc. | Add: no Edit: no |
Note: Required fields will be subject to change during later iterations.
Example of request body:
[
{
"name": "Samsung Pametni telefon Galaxy SM-A325F plavi",
"description": "Samsung Galaxy SM-A325F. Dijagonala monitora: 16,3 cm (6.4\"), Rezolucije ekrana: 1800 x\n2400 piksela, Tip ekrana: SAMOLED. Takt procesora: 2 GHz. RAM kapacitet: 4 GB, Kapacitet interne memorije: 128 GB. Rezolucija zadnje kamere (numerička): 64 MP, Tip zadnje kamere: Četvorostruka kamera. Mogućnosti SIM kartice: Dve SIM kartice. Trajanje baterije: 5000 mAh. Boja proizvoda: Plavo. Težina: 184 g",
"coverImage": "https://ananas.rs/_next/image?url=https%3A%2F%2Fstatic.ananas.rs%2Ftmp%2Fimage- thumbnails%2FProduct_Images%2FSmartphones%2Fsamsung_galaxy_sm_a325f_16_3_cm_6_4_dve_sim_karti ce_4g_usb_tipa_c_4_gb_128_gb_5000_mah_plavo%2Fimage- thumb__295826__product_thumbnail%2F951c5c5b9fdddc72.jpeg&w=3200&q=75",
"ean": "9788644105886",
"brand": "Samsung",
"gallery": [
"https://ananas.rs/_next/image?url=https%3A%2F%2Fstatic.ananas.rs%2Ftmp%2Fimage- thumbnails%2FProduct_Images%2FSmartphones%2Fsamsung_galaxy_sm_a325f_16_3_cm_6_4_dve_sim_karti ce_4g_usb_tipa_c_4_gb_128_gb_5000_mah_plavo%2Fimage- thumb__295826__product_thumbnail%2F951c5c5b9fdddc72.jpeg&w=3200&q=75"
],
"parentEan": "",
"packageWeightValue": 184,
"packageWeightUnit": "KG",
"basePrice": 30990,
"vat": 20,
"stockLevel": 5,
"sku": "LXG9HET6O3",
"externalId": "1",
"productType": "Telefon",
"category": "SMART mobilni telefoni",
"attributes": {
"Boja": [
"Plava"
],
"Standard veličine": [
"Monoblokovi"
],
"Sirina": [
"73.6 mm"
],
"Dubina": [
"8.4 mm"
],
"Visina": [
"158.9 mm"
],
"Tezina": [
"184 g"
]
}
}
]
Important Request information
If for whatever reason you do not have information on any of the non-required fields, you can simply place null value instead.
Since we are working with different stock levels, price and other linked things for a given product that could impact the status of merchant selling, all the provided data for on required fields will be kept as previous or existing ones in case they are missing from the request. Exception is stockLevel, if stockLevel has negative value, previous stockLevel will be set to zero.
StockLevel can be 0 or greater, but packageWeightValue and basePrice must be positive non 0 numbers.
Currently the packageWeight unit is hardcoded and will always be KG, even if some other value is passed.
Valid VAT values are 0, 10 and 20, if included in the request
Response
If EAN is not yet linked to a given merchant, a new product for him will be created in our database and its respective ID will be generated alongside it. If EAN is already linked to a given merchant, then the product will be updated in the database
If EAN does not exist on our database, then the product will be added and linked to merchant later.
Once the desired product is updated, if the basePrice that was sent differs from the basePrice, it will be updated after midnight at 00:01.
Request will process asynchronous, and progression of the process can be tracked from value that is given in response, but at this moment is not open to public use.
Response Body:Fields name | Type | Description |
id | UUID | Progress id which can be used to track progress |
Example of response:
{
"id": "c52813ec-f69b-4202-bb03-0a2534c93781"
}