XM

Retrieve Cart by Cart ID or Authorization Token

Path:

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

Existing cart details can be retrieved through this endpoint, by specifying the cartId (for guest users) or the userAuthToken (for logged in users) in the request path.

Headers

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

By CartId

https://{baseurl}/api-cart/cart-decoupled?cartId=5f13883765bc750008b58293

By Authorization Token

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

Response

Response Code: 200

Message: OK

Sample

{
"_id": "5f13883765bc750008b58293",
"deleted": false,
"registeredUser": false,
"cartId": 1534,
"items": [
{
"price": {
"discount": {
"price": 0,
"discountAmount": 0,
"promosApplied": []
},
"sale": 68,
"base": 85,
"currency": "USD"
},
"discountedQuantity": 0,
"group": [
"5e31a1f9fcc2b500089c10e8"
],
"weightUnit": "lb",
"createdAt": "2020-07-18T22:19:41.035Z",
"updatedAt": "2020-07-18T23:43:26.299Z",
"_id": "5f13889465bc750008b58297",
"itemId": 1000000038,
"quantity": 2,
"sku": "1554213",
"taxCode": "PH060771",
"title": "Glo Pillow Light Gray",
"weight": 2,
"lineItemId": 1,
"totalPrice": {
"currency": "USD",
"amount": 136
},
"id": "5f13889465bc750008b58297"
}
],
"userId": "5f138820708ffb0007e609b0",
"allPromosApplied": [],
"createdAt": "2020-07-18T23:39:35.978Z",
"updatedAt": "2020-07-18T23:43:26.323Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 136
},
"quantity": 2,
"errors": {
"inventory": [],
"price": [],
"promo": []
}
}

Response Code: 404

Message: Cart Not Found

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