Skip to content

Commit ece610a

Browse files
authored
Merge pull request #486 from oshmyheliuk/CEXT-5060
CEXT-5060: Extend REST API by adding custom attributes to /V1/carts endpoint
2 parents 1c94f02 + 6add36b commit ece610a

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/pages/rest/modules/custom-attributes.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Adobe Commerce as a Cloud Service does not support REST endpoints that modify th
3131

3232
When the quote is converted to an order, the custom attributes are copied to the order.
3333

34-
The following example shows how to set custom attributes on a cart. The `quote` object contains the `custom_attributes` array, which includes the custom attributes to set.
34+
The following example shows how to set custom attributes on a cart when assigning a customer to a cart. The `quote` object contains the `custom_attributes` array, which includes the custom attributes to set.
3535

3636
```curl
3737
curl -i -X PUT \
@@ -56,10 +56,33 @@ curl -i -X PUT \
5656
]
5757
}
5858
}' \
59-
'https://<COMMERCE_URL>/rest/all/V1/carts/'
59+
'https://<COMMERCE_URL>/rest/all/V1/carts/{cartId}'
6060
```
6161

62-
A quote item with custom attributes can be added/updated using `PUT /V1/carts/{cartId}/items/:itemId`.
62+
The `POST /V1/carts/{cartId}/customAttributes` endpoint allows you to set or update custom attributes on already existing carts. The request body must include the `cart_id` and an array of `custom_attributes`.
63+
64+
```curl
65+
curl -i -X POST \
66+
-H "Content-Type:application/json" \
67+
-H "Authorization:Bearer <TOKEN>" \
68+
-d \
69+
'{
70+
"cart_id": "20",
71+
"custom_attributes":[
72+
{
73+
"attribute_code": "attr_one",
74+
"value": "value_one"
75+
},
76+
{
77+
"attribute_code": "attr_two",
78+
"value": "value_two"
79+
}
80+
]
81+
}' \
82+
'https://<COMMERCE_URL>/rest/all/V1/carts/{cartId}/customAttributes'
83+
```
84+
85+
A quote item with custom attributes can be added/updated using `PUT /V1/carts/{cartId}/items/{itemId}`.
6386

6487
```curl
6588
curl -i -X PUT \
@@ -115,7 +138,7 @@ curl -i -X POST \
115138

116139
### Creditmemo
117140

118-
You can use the `POST V1/creditmemo` and `PUT V1/creditmemo/:id` endpoints to set custom attributes on a credit memo and its items.
141+
You can use the `POST V1/creditmemo` and `PUT V1/creditmemo/{id}` endpoints to set custom attributes on a credit memo and its items.
119142

120143
```curl
121144
curl -i -X POST \

0 commit comments

Comments
 (0)