Catalogue Item
Allows for linking between the product and the catalog. While the product is moved to the previously created catalog, an instance is created from the CatalogItem
model that is associated with the product and the catalog. A product can be added to multiple catalogs.
GET
Catalog Item
GET
Catalog ItemSample HTTP request to get all catalog item lists from the system.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. You can retrieve api_token
by logging in.
Request
Path: /api/v1/catalog_items/
import requests
url = "https://{customer_api_url}/api/v1/catalog_items/"
api_token = "API TOKEN"
headers = {
'content-type': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}
response = requests.get(url, headers=headers)
print(response.text)
Response
Returns the catalog ID and the product ID of the corresponding catalog item.
{
"count": n,
"next": "/api/v1/catalog_items/?page=2",
"previous": null,
"results": [
{
"pk": 1,
"product": 1,
"catalog": 1,
"created_date": "2020-05-07T11:25:03.745360Z",
"modified_date": "2020-05-07T11:25:03.745387Z"
},
{
"..."
}
]
}
POST
Create Catalog Item
POST
Create Catalog ItemAfter the product and catalog models are created, the post request is sent using the pk information of the relevant models. The product and catalog ID must be unique, otherwise it will throw an error. (“product”, “catalog” fields should form a unique set.)
Path: /api/v1/catalog_items/
{
"product": {product-pk},
"catalog": {catalog-pk}
}
Response
Returns the properties of the created catalog items.
Response Status Code: 201 and parameter detail.
{
"pk":{catalogitem-pk},
"product":{product-pk},
"catalog":{catalog-pk},
"created_date":"2021-05-11T10:46:47.996741Z",
"modified_date":"2021-05-11T10:46:47.996769Z"
}
DELETE
Catalog Item
DELETE
Catalog ItemPath: /api/v1/catalog_items/{catalog-item-pk}/
Response
Response Status Code: 204
Last updated
Was this helpful?