Logo
maya API Documentation

Add item to cart

POST {{baseUrl}}/cart

Service urls:
http://yourdomain.com/api/rest/cart
OR
http://yourdomain.com/index.php?route=rest/cart/cart
Sample cart item object:
productid=34 (iPod Shuffle)
product
optionid =235 (Size)
product
optionvalueid = 30 (Large)

{
product_id: 34,
quantity: 1,
option:
{
235: 30
}

}

Add recurring item to the cart:
{
product_id: 43,
quantity: 1,
recurring_id: 2

}

Option for text field:
option: {
238:demo text
}
br>Option for date field:

option: {
238:2014-10-15
}

Option for checkbox field:
option: {
236: [33]
}

Option for checkbox field ( multiple selected ):
option: {
236: [33, 32]
}

Option for select field:
option: {
235:30
}

Option for radio field:
option: {
237:35
}

And all together:
option: {
235: 30,
237:34,
238:demo text,
239:2014-11-20,
236: [33]
}

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
X-Oc-Session
string (Required) User session id
Content-Type
string
Accept
string




RESPONSES

status OK





Curl
curl -X POST 'https://api.opencart-api.com/api/rest/cart' -H 'X-Oc-Session: voluptate' -H 'Content-Type: application/json' -H 'Accept: */*' -d '{"product_id":34,"quantity":2}'

ENDPOINTS