XM

Retrieve Cart by Cart ID or Authorization Token

Path:

GET https://{baseurl}/api-cart/cart?cartId={cartId}
or
GET https://{baseurl}/api-cart/cart?userAuthToken={userAuthToken}

This API facilitates retrieval of an existing cart details based on the cartId or the userAuthToken.

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type : query

Name : Either the cartId (from the Add Items to Cart API) or the Authorization Token (JWT userAuthToken from the Login API).

Required: true

Sample Request

Path: By Cart ID

https://{baseurl}/api-cart/cart?cartId=607f8a8f0118960009a8e6ee

Path: By Authorization Token

https://{baseurl}/api-cart/cart?userAuthToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMTM4ODIwNzA4ZmZiMDAwN2U2MDliMCIsInJvbGVzIjpbeyJpZCI6IjVkZDY4NDVkNTMzYTZlYjQ5NTNhYzVlNSJ9XSwiaWF0IjoxNTk1MTE1NTYzLCJleHAiOjE1OTUxMTczNjN9.G_Mx4KcK0D4oZ4ZorXXRDEbPtiV74IK_E2TouKwubYbNNmktUaqMlhy4JgES9qnzvUd8y7QthrJbzJHZHRBYZA

Response

Success Code: 200

Message: OK

Description: You'll see this message when the cart details are successfully retrieved based on the cart ID.

Sample Response

{
"_id": "607f8a8f0118960009a8e6ee",
"deleted": false,
"registeredUser": true,
"cartId": 1475,
"items": [
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 0,
"base": 900,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"123123123123123213212222"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T02:14:38.620Z",
"updatedAt": "2021-04-21T17:47:19.244Z",
"_id": "607f8a8f0118960009a8e6ef",
"itemId": 1000000051,
"quantity": 2,
"priceListId": 100269,
"sku": "1538910",
"taxCode": "PH060771",
"title": "Luminous Cushion Lagoon",
"weight": 1,
"lineItemId": 1,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 1800
},
"attributes": [],
"id": "607f8a8f0118960009a8e6ef"
},
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 48,
"base": 148,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"123123123123123213212222"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T02:14:38.620Z",
"updatedAt": "2021-04-21T17:47:19.244Z",
"_id": "607f8a8f0118960009a8e6f0",
"itemId": 1000000052,
"quantity": 2,
"priceListId": 100269,
"sku": "1583908",
"taxCode": "PH060771",
"title": "Embellished Pillow Pink",
"weight": 1,
"lineItemId": 2,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 96
},
"attributes": [],
"id": "607f8a8f0118960009a8e6f0"
}
],
"userId": "600a56593245200007982fac",
"allPromosApplied": [],
"attributes": [],
"createdAt": "2021-04-21T02:14:39.048Z",
"updatedAt": "2021-04-21T17:47:19.269Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 1896
},
"quantity": 4,
"errors": {
"inventory": [],
"price": [],
"promo": []
}
}

Success Code: 200

Message: OK

Description: You'll see this message when the cart details are successfully retrieved based on the Authorization token.

Sample Response

{
"_id": "607f8a8f0118960009a8e6ee",
"deleted": false,
"registeredUser": true,
"cartId": 1475,
"items": [
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 0,
"base": 900,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"123123123123123213212222"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T02:14:38.620Z",
"updatedAt": "2021-04-21T17:48:43.011Z",
"_id": "607f8a8f0118960009a8e6ef",
"itemId": 1000000051,
"quantity": 2,
"priceListId": 100269,
"sku": "1538910",
"taxCode": "PH060771",
"title": "Luminous Cushion Lagoon",
"weight": 1,
"lineItemId": 1,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 1800
},
"attributes": [],
"id": "607f8a8f0118960009a8e6ef"
},
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 48,
"base": 148,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"123123123123123213212222"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T02:14:38.620Z",
"updatedAt": "2021-04-21T17:48:43.011Z",
"_id": "607f8a8f0118960009a8e6f0",
"itemId": 1000000052,
"quantity": 2,
"priceListId": 100269,
"sku": "1583908",
"taxCode": "PH060771",
"title": "Embellished Pillow Pink",
"weight": 1,
"lineItemId": 2,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 96
},
"attributes": [],
"id": "607f8a8f0118960009a8e6f0"
}
],
"userId": "600a56593245200007982fac",
"allPromosApplied": [],
"attributes": [],
"createdAt": "2021-04-21T02:14:39.048Z",
"updatedAt": "2021-04-21T17:48:43.031Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 1896
},
"quantity": 4,
"errors": {
"inventory": [],
"price": [],
"promo": []
}
}

Error Code: 404

Message: Cart not found

Description: You will see this error when the cart ID doesn't exist in the system.

{
"code": "CART_NOT_FOUND",
"message": "Cart not found."
}

Error Code: 400

Message: Request validation

Description: You will see this error when the cart ID is lesser or greater than 24 characters.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in path: /cartId should NOT be shorter than 24 characters"
}

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated