API documentation
Method list
Test your request
Changelog


addInventoryProduct
The method allows you to add a new product to BaseLinker catalog. Entering the product with the ID updates previously saved product.


Input parameters
inventory_idvarchar(30)Catalog ID. The list of identifiers can be retrieved using the method getInventories. (inventory_id field).
product_idvarchar(30)Main product identifier, given only during the update. Should be left blank when creating a new product. The new product identifier is returned as a response to this method.
parent_idvarchar(30)Product parent ID. To be provided only if the added/edited product is a variant of another product.
is_bundleboolIs the given product a part of a bundle
eanvarchar(32)Product EAN number.
skuvarchar(50)Product SKU number.
tax_ratefloatVAT tax rate e.g. "23", (value from range 0-100, EXCEPTION values: "-1" for "EXPT"/"ZW" exempt from VAT, "-0.02" for "NP" annotation, "-0.03" for "OO" VAT reverse charge)
weightdecimal(10,2)Weight in kilograms.
heightdecimal(10,2)Product height
widthdecimal(10,2)Product width
lengthdecimal(10,2)Product length
average_costdecimal(10,2)Product average cost. If storage documents are turned off, this field sets product average cost. If storage documents are turned on, a value in this field can be set in two cases: while creating a new product or when a current average cost is set to 0.
starintProduct star type. It takes from 0 to 5 values. 0 means no starring.
manufacturer_idintProduct manufacturer ID. IDs can be retrieved with getInventoryManufacturers method.
category_idintProduct category ID (category must be previously created with addInventoryCategories) method.
pricesarrayA list containing product prices, where the key is the price group ID and value is a product gross price for a given price group. The list of price groups can be retrieved with getInventoryPriceGroups method.
stockarrayA list containing product stocks, where the key is the warehouse ID and value is a product stock for a given warehouse. Warehouse ID should have the following format: "bl_[id:int]" (eg. "bl_123").The list of warehouse IDs can be retrieved with getInventoryWarehouses method. Stocks cannot be assigned to the warehouses created automatically for purposes of keeping external stocks (shops, wholesalers, etc.).
locationsarrayA list containing product locations where the key is the warehouse ID and value is a product location for a given warehouse, eg. "A-5-2". Warehouse ID should have the following format: "[type:bl|shop|warehouse]_[id:int]" (eg. "bl_123"). The list of warehouse IDs can be retrieved with getInventoryWarehouses method. To assign multiple locations to a single warehouse, separate them with a semicolon.
text_fieldsarrayA list containing field text values (names, descriptions, etc.) of a product, where the key is the field text ID and value is the field value. The field text ID consists of the following components separated with the "|" character:
  • [field] - Field name. Accepted field names: "name", "description", "features", "description_extra1", "description_extra2", "description_extra3", "description_extra4", "extra_field_[extra-field-ID]" e.g. "extra_field_75". The list of extra fields IDs can be retrieved with getInventoryExtraFields method.
  • [lang] - A two-letter code of language, which gets assigned given value e.g. "en". If this value is not specified, the default catalog language is assigned. The list of languages available for each integration can be retrieved with getInventoryIntegrations method.
  • [source_id] - Integration ID provided when the given text field value is to be overwritten only for a specific integration. ID should have a following format: "[type:varchar]_[id:int]", where the type means a kind of integration (e.g. "ebay", "amazon", "google"), and ID is an account identifier for given integration (eg. "ebay_2445").
    If a value is to be overwritten throughout the integration (e.g. for all Amazon accounts), the value "0" should be used as the identifier. (e.g. "amazon_0").
Examples of text field identifiers:
  • "name" - Default name assigned to the default language.
  • "name|de" - Name assigned to a particular language.
  • "name|de|amazon_0" - Name assigned to a specific language for all Amazon accounts.
  • "name|de|amazon_123" - Name assigned to a specific language for an Amazon account with ID 123.
The list of all text field identifiers can be retrieved with the getInventoryAvailableTextFieldKeys method.

In the case of the name and short additional fields, the character limit for the field value is 200. When specifying the value of a product feature (field "features"), provide a list where the key is the name of the parameter (e.g. "Colour") and the value is the value of that parameter (e.g. "White").

In case of file the following format is expected:
{
    "title": "file.pdf" (varchar(40) - the file name)
    "file": "data:4AAQSkZJRgABA[...]" (binary - the file body limited to 2MB)
}
imagesarrayA list of product images (maximum 16). Each element of the list is a separate photo where the key is the photo position in the gallery (numbering from 0 to 15). You can delete a photo by sending "" at the selected position. You can submit a photo in binary format, or a link to the photo. In case of binary format, the photo should be coded in base64 and at the very beginning of the photo string the prefix "data:" should be provided. In case of link to the photo, the prefix "url:" must be given before the link. Example:
{
    "0": "url:http://adres.pl/zdjecie.jpg", (url - the photo url limited to 1000 characters length)
    "3": "data:4AAQSkZJRgABA[...]", (binary - the photo content limited to 2MB)
    "5": "", (empty - to delete the photo)
     ...
}
linksarrayAn array containing product links to external warehouses (e.g. shops, wholesalers). Each element of the array is a list in which the key is the identifier of the external warehouse in the format "[type:shop|warehouse]_[id:int]". (e.g. "shop_2445"). The warehouse identifiers can be retrieved with the getStoragesList method. The value is an array containing the fields listed below.
| - product_id varcharProduct identifier in external warehouse.
| - variant_id (optional) varcharProduct variant identifier in the external warehouse. When assigning a link to a main product, this parameter shall be omitted or a value of 0 provided.
bundle_productsarrayA list containing information about the products included in the bundle, where the key is the identifier of the product included in the bundle, and the value is the number of pieces of this product in the bundle.
Subproducts can only be defined if the added/edited product is a bundle (is_bundle = true).



Output data
The method returns the data in JSON format.
statusvarchar(30)SUCCESS - request executed correctly
ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code
product_idvarchar(30)The number of an added or updated product in the BaseLinker catalogue. In an external application you should create a link between the internal number and the number received here. It will later be used to update the added product. This number will also be included in the order items in the getOrders function.
warningsobjectAn object with notes on adding a product (e.g. image errors or others that do not interrupt the request). Each object field informs about a separate error.



Sample
Input data:
Output data:
A sample request in PHP: