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 MethodPOST
URLStagehttps://api.stage.ananastest.com/product/api/v1/merchant-integration/import
Productionhttps://api.ananas.rs/product/api/v1/merchant-integration/import
HTTP Headers
Header nameHeader value
AuthorizationBearer {access_token}
Request Body:
Fields nameTypeDescriptionRequired
nameStringProduct name

Add: yes

Edit: yes

descriptionStringProduct description (allows html tags, <br>,<ul>,<ol>,<li> excluding <b> or <i>)

Add: yes

Edit: yes

coverImageStringProduct cover image

Add: yes

Edit: yes

eanStringEuropean Article Number

Add: yes

Edit: yes

brandStringProduct brand

Add: yes

Edit: no

galleryList<String>Product images

Add: yes

Edit: no

parentEanStringThe product will be a variation of the product to which the EAN is entered

Add: no

Edit: no

packageWeightValueBigDecimal/DoublePackage weight of product

Add: yes

Edit: no

packageWeightUnitStringProduct weight package unit

Add: yes

Edit: no

basePriceBigDecimal/DoubleProduct price with VAT included

Add: yes

Edit: no

vatBigDecimal/DoubleProduct VAT

Add: yes

Edit: no

stockLevelIntegerProduct available stock level

Add: yes

Edit: no

skuStringStock keeping unit

Add: yes

Edit: no

externalIdStringUnique product identifier on merchant side

Add: no

Edit: no

productTypeStringType of product

Add: no

Edit: no

categoryStringMain category where product belongs

Add: no

Edit: no

attributesMap<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:

Click to copy
Success!
[
  {
    "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 nameTypeDescription
idUUIDProgress id which can be used to track progress

Example of response:

Click to copy
Success!
    {
        "id": "c52813ec-f69b-4202-bb03-0a2534c93781"
    }
Copyright © Ananas 2023. All right reserved.