Products
The products endpoint contains a product list of your products and methods to upload your products. You can use your own product list with your unique article codes.
Attributes
| Name | Type | Required | Description |
|---|---|---|---|
| brand | string | required | The product brand |
| name | string | required | The name of your product. |
| productcode_supplier | string | required | Your product code. This code must be unique |
| tag | integer | required | The code of the tag for this product. See tags |
| bonus_type | integer | required | 0 = None, 1 = Bonus determiner, 2 = Entitled to bonus |
| created_on | date/time | generated | The date and time this product was created |
| modified_on | date/time | generated | The time and date this product was last modified |
Get All Products With this call, you will get all your products.
GET https://test-api.centrop.app/products/ GET https://api.centrop.app/products/
RESPONSE
HTTP/1.1 200 OK
1{
2 "count": 14519,
3 "results": [
4 {
5 "brand": "Merk A",
6 "name": "Product 1",
7 "productcode_supplier": "58477",
8 "tag": 2470,
9 "bonus_type": 0,
10 "created_on": "2022-07-12 10:32:42.319434+00:00",
11 "modified_on": "2022-08-04 09:55:43.384159+00:00"
12 },
13 {
14 "brand": "vdsa",
15 "name": "ashish",
16 "productcode_supplier": "nbhn",
17 "tag": 7938,
18 "bonus_type": 0,
19 "created_on": "2022-08-26 07:07:51.596969+00:00",
20 "modified_on": "2022-08-26 07:09:37.227268+00:00"
21 },
22 {
23 "brand": "bb",
24 "name": "pp",
25 "productcode_supplier": "jinjknl",
26 "tag": 9251,
27 "bonus_type": 1,
28 "created_on": "2022-09-05 10:34:43.234584+00:00",
29 "modified_on": "2022-09-05 10:34:43.234599+00:00"
30 }
31 ]
32}
Filters
You can filter the products with the following parameters. Add these filters as querystring parameters to the URL.
| Attribute | Description | Example |
|---|---|---|
| brand | Get the products that has the given brand associated with them. | Test brand |
| productcode_supplier | Get the products that has the given product code associated with them. | 4756245 |
| tag | Get the products that has the given tag name associated with them. | 6333 |
| bonus_type | Get the products that has the given bonus type associated with them. | 1 |
Create New Product / Update Product
The endpoint supports multiple products at once. If you POST a product with an existing productnumber, the product will updated otherwise it will be added. The response gives detailed information about created, updated and faulty products.
WARNING: You cannot update a tag and a bonus_type of a product. If a product is a missing product and doesn't have a tag associated with it, you can update the product tag.
POST https://test-api.centrop.app/products POST https://api.centrop.app/products
REQUEST
1[{
2 "brand": "MyBrand",
3 "name": "My existing product 1",
4 "productcode_supplier": "4756245",
5 "tag": "6333",
6 "bonus_type": 2
7},
8{
9 "brand": "MyBrand",
10 "name": "My new product 1",
11 "productcode_supplier": "5656245",
12 "tag": "4951",
13 "bonus_type": 1
14},
15{
16 "brand": "MyBrand",
17 "name": "My new product 2",
18 "productcode_supplier": "3456245",
19 "tag": "9695",
20 "bonus_type": 2
21},
22{
23 "brand": "MyBrand",
24 "name": "",
25 "productcode_supplier": "3456245",
26 "tag": "",
27 "bonus_type": 0
28}]
RESPONSE
HTTP/1.1 200 OK
1{
2 "add data": [
3 {
4 "brand": "MyBrand",
5 "name": "My new product 1",
6 "productcode_supplier": "5656245",
7 "tag": "4951",
8 "created_on": "2022-07-12 10:32:42.319434+00:00",
9 "modified_on": "2022-08-04 09:55:43.384159+00:00"
10 }
11 ],
12 "update data": [
13 {
14 "brand": "MyBrand",
15 "name": "My existing product 1",
16 "productcode_supplier": "4756245",
17 "tag": "6333",
18 "created_on": "2022-07-12 10:32:42.319434+00:00",
19 "modified_on": "2022-08-04 09:55:43.384159+00:00"
20 }
21 ],
22 "error data": [
23 {
24 "brand": "MyBrand",
25 "name": "My new product 2",
26 "productcode_supplier": "3456245",
27 "tag": "9695",
28 "error": {
29 "tag": "Please add the tag not the category"
30 }
31 },
32 {
33 "brand": "MyBrand",
34 "name": "",
35 "productcode_supplier": "3456245",
36 "tag": "",
37 "error": {
38 "tag": "Please insert the valid tag code",
39 "name": "Please insert the valid name"
40 }
41 }
42 ]
43}
In this example we POST four products. The first product is an existing product. You can see the status of that product in “Update data:”
The second product is a new product. You can see the status in “Add data”
The third product is also new, but contains errors. “My new product 2” contains a tag code which is not he lowest in the hierarchy. We only accept the lowest code in the hierarchy. You can download the producttags Excel file from the supplier portal. OR use the hierarchy menu option in the same portal.
The fourth product has two errors. We always send all errors at once. Here you can see the tag and the name are incorrect.