Add Items to Cart
1 min
POST
https://api.upstartcommerce.com/v1/cart/profile/cart/items
Header Parameters
- x-upstart-tenantstringrequiredDescription
- x-upstart-sitestringrequiredDescription
Body Parameters
- bodyAddCartItemsrequiredDescription
- itemsAddCartItem[]requiredDescription
- idstring<uuid>DescriptionFormatuuid
- catalogItemIdstringrequiredDescription
- productItemSkuIdstringDescriptionDefaultN/A
- targetItemIdsstring[]DescriptionDefault
- targetShipmentIdsstring[]DescriptionDefault
- quantityinteger<int32>DescriptionFormatint32
- shippingMethodIdstring<uuid>DescriptionFormatuuid
- locationIdstringExampleDescription
- postalCodestringExampleDescription
- countrystringExampleDescription
- currencystringExampleDescription
- timezoneIdstringExampleDescription
Responses
201
- CartItemsUpdatedDescription
- idstring<uuid>requiredDescriptionFormatuuid
- itemIdsstring[]required
400
- ValidationErrorResponse
- namestringrequired
- codestringrequired
- detailstring
401
- ErrorResponse
- namestringrequired
- codestringrequired
- detailstringrequired
- reasonstring
404
- ErrorResponse
- namestringrequired
- codestringrequired
- detailstringrequired
- reasonstring
curl
curl --request POST \
--url https://api.upstartcommerce.com/v1/cart/profile/cart/items \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-upstart-tenant: string' \
--header 'x-upstart-site: string' \
--data '{
"items": [
{
"catalogItemId": "",
"productItemSkuId": "N/A",
"targetItemIds": [],
"targetShipmentIds": []
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-upstart-tenant", "string");
myHeaders.append("x-upstart-site", "string");
var raw = JSON.stringify({
"items": [
{
"catalogItemId": "",
"productItemSkuId": "N/A",
"targetItemIds": [],
"targetShipmentIds": []
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/v1/cart/profile/cart/items", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/v1/cart/profile/cart/items")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["x-upstart-tenant"] = "string"
request["x-upstart-site"] = "string"
request.body = JSON.dump({
"items": [
{
"catalogItemId": "",
"productItemSkuId": "N/A",
"targetItemIds": [],
"targetShipmentIds": []
}
]
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/v1/cart/profile/cart/items"
payload = json.dumps({
"items": [
{
"catalogItemId": "",
"productItemSkuId": "N/A",
"targetItemIds": [],
"targetShipmentIds": []
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'x-upstart-tenant': 'string',
'x-upstart-site': 'string'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Success-the items were added to the cart.
{
"id": "",
"itemIds": [
""
]
}400
// The request contained information that the server was unable to process. Appropriate errors are provided in the response body.
{
"name": "",
"code": "",
"detail": ""
}401
// The provided credentials were not valid for this endpoint. It may be that they are expired or that the user's roles are insufficient.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}404
// The requested resource was not found in the NoChannel system.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}