Ecommerce: Carts
GET /shops/{shopId}/carts
Sending GET request to this url, returns collection of CART resources that belong to given shop.
You can narrow down list of resources by passing proper query parameters (list of which you can find below in request params section). You can basically search by:
- externalId
- createdOn
You can specify which page of results you want and how many results per page should be there. You can also specify sort-order using one or more of allowed fields (listed below in request params section).
Last but not least you can even specify which fields from resource you want to get. If you pass param `fields` with list of fields (separated by comma [,]) we will return list of resources with only those fields (we will always add resource id to ensure that you can use that data later on)
Returns status code
200
Request url
/shops/p/carts?query[createdOn][from]=2010-10-13&query[createdOn][to]=2020-03-15
Request params
Field name | Field type | Field description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
query | hash | Used to search only resources that meets criteria. You can specify multiple parameters, then it uses AND logic.
| |||||||||
fields | string | List of fields that should be returned. Id is always returned. Fields should be separated with comma | |||||||||
sort | hash | Enable sorting using specified field (set as a key) and order (set as a value). You can specify multiple fields to sort by.
| |||||||||
perPage | int | Number results on page | |||||||||
page | int | Page number |
Example Response
[
{
"cartId": "V",
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98,
"href": "https://api.getresponse.com/v3/shops/V/variants/V"
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart?ref=nQx",
"href": "https://api.getresponse.com/v3/shops/V/carts/V",
"createdOn": "2017-04-04T08:13:05+0000",
"updatedOn": "2017-04-04T08:15:17+0000"
}
]
Possible Errors
GET /shops/{shopId}/carts/{cartId}
Method returns CART with given cartId in context of given shopId
Returns status code
200
Request url
/shops/p/carts/V
Request params
Field name | Field type | Field description |
---|---|---|
fields | string | List of fields that should be returned. Id is always returned. Fields should be separated with comma |
Example Response
{
"cartId": "V",
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98,
"href": "https://api.getresponse.com/v3/shops/V/variants/V"
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart?ref=nQx",
"href": "https://api.getresponse.com/v3/shops/V/carts/V",
"createdOn": "2017-04-04T08:13:05+0000",
"updatedOn": "2017-04-04T08:15:17+0000"
}
Possible Errors
POST /shops/{shopId}/carts
Sending a POST request to this url, will create a new CART resource.
In order to create a new CART, you need to send CART resource in BODY of the request (remember that you need to serialize body into JSON string)
Returns status code
201
Example Request Body
{
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart/nQ"
}
Body params
Field name | Field type | Field description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
contactId (required) | string | ID of contact that the cart belongs to, you must first create contact using POST /v3/contacts or if it already exists, using GET /v3/contacts | |||||||||||||||
totalPrice (required) | float | Total price of order excl. taxes | |||||||||||||||
totalTaxPrice | float | Total price of order incl. taxes | |||||||||||||||
currency (required) | string | Cart currency - ISO 4217 | |||||||||||||||
selectedVariants (required) | collection | Collection of selected product variants
| |||||||||||||||
externalId | string | External cart ID, free text | |||||||||||||||
cartUrl | string | External cart URL |
Example Response
{
"cartId": "V",
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98,
"href": "https://api.getresponse.com/v3/shops/V/variants/V"
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart/nQ",
"href": "https://api.getresponse.com/v3/shops/V/carts/V",
"createdOn": "2017-04-04T08:13:05+0000",
"updatedOn": "2017-04-04T08:15:17+0000"
}
Possible Errors
POST /shops/{shopId}/carts/{cartId}
Update properties of shops CART. You should send only those fields that need to be changed. The rest of properties will stay the same.
In case of selectedVariants when collection is updated then old one is completely removed.
Returns status code
200
Example Request Body
{
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart/nQ"
}
Body params
Field name | Field type | Field description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
contactId | string | ID of contact that the cart belongs to, you must first create contact using POST /v3/contacts or if it already exists, using GET /v3/contacts | |||||||||||||||
totalPrice | float | Total price of order excl. taxes | |||||||||||||||
totalTaxPrice | float | Total price of order incl. taxes | |||||||||||||||
currency | string | Cart currency - ISO 4217 | |||||||||||||||
selectedVariants | collection | Collection of selected product variants
| |||||||||||||||
externalId | string | External cart ID, free text | |||||||||||||||
cartUrl | string | External cart URL |
Example Response
{
"cartId": "V",
"contactId": "Vp",
"currency": "USD",
"totalPrice": 1234.56,
"selectedVariants": [
{
"variantId": "V",
"quantity": 3,
"price": 57,
"priceTax": 98,
"href": "https://api.getresponse.com/v3/shops/V/variants/V"
}
],
"externalId": "ext-id",
"totalTaxPrice": 12345.67,
"cartUrl": "http://example.com/cart/nQ",
"href": "https://api.getresponse.com/v3/shops/V/carts/V",
"createdOn": "2017-04-04T08:13:05+0000",
"updatedOn": "2017-04-04T08:15:17+0000"
}