Handling order line properties
This article will guide you through how handle CRUD operations on your baskets order line properties, using our headless API. The Postman collection will be used for all examples.
In order to show changes to the basket immediately, you have the option of enabling a mini basket view in all of the following requests. Find out more in the Available views section.
Prerequisites
-
accessTokenfrom Connect flow. -
basketIdfrom Creating a basket.
Creating order line properties on your basket
Additional prerequisites
lineIdof the order line to add properties to. (string)
Create your properties
Open the Create basket order line property request.
Enter the basketId, lineId, priceGroupId and cultureCode properties in the appropriate places.
Request:
curl -D- -X POST {base_url}/api/v1/baskets/{basketId}/{lineId}/properties \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json' \
-d '{
"cultureCode": "{cultureCode}",
"priceGroupId": "{priceGroupId}",
"key": "{key}",
"value": "{value}"
}'
Response:
{
"miniBasket": null,
"success": true
}
Deleting order line properties on your basket
Additional prerequisites
lineIdof the order line you want to delete from. (string)propertyIdof the property you wish to delete. (string)
Deleting your properties
Open the Delete basket order line property request.
Enter the basketId, lineId and propertyId in appropriate places.
Request:
curl -D- -X DELETE {base_url}/api/v1/baskets/{basketId}/lines/{lineId}/properties/{propertyId} \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json' \
-d '{
"cultureCode": "{cultureCode}",
"priceGroupId": "{priceGroupId}",
}'
Response:
{
"miniBasket": null,
"success": true
}
Getting the order line properties on your basket
Additional prerequisites
lineIdof the order line you wish to get your properties from. (string)
Get your properties
Open the Get basket order line property request.
Enter the basketId and lineId properties in the appropriate places.
Request:
curl -D- -X GET {base_url}/api/v1/baskets/{basketId}/lines/{lineId}/properties \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json' \
Response:
{
"customProperties": []
}
Updating your properties
Additional prerequisites
lineIdof the order line you wish to update properties on. (string)propertyIdof the property you wish to update. (string)
Update basket order line property
Open the Update basket order line property request.
Enter the basketId, lineId and propertyId properties in the appropriate places.
Request:
curl -D- -X PATCH {base_url}/api/v1/baskets/{basketId}/lines/{lineId}/properties/{propertyId} \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json' \
-d '{
"cultureCode": "{cultureCode}",
"priceGroupId": "{priceGroupId}",
"value": "newPropValue"
}'
Response:
{
"miniBasket": null,
"success": true
}
Possible errors that may occur:
| Error | Description |
|---|---|
| BadRequest (400) | Execution of the pipeline fails; AccessToken was not attached. |
| Unauthorized (401) | The token is expired. |
| Forbidden (403) | The token does not have access to this endpoint. |
| NotFound (404) | Basket with the supplied id basketId was not found. |
| Conflict (409) | Key already exists. |
{
"errors": [
{
"error-description": "Basket with the supplied id basketId was not found",
"error": "NotFound"
}
]
}
See Handling failures for more info.