XM

Retrieve Attributes By Item IDs

Path:

POST https://{baseurl}/api-configuration/attribute/get-by-item-ids

Enables you to retrieve attribute details, by item IDs. The response includes the list of item IDs (specified in the request) along with their attributes. If no attribute is mapped to any of the requested item IDs, the status, code, and message are displayed to indicate the error reason.

Headers

Content-Type : application/json

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

Parameters

Type: Body

Name: The list of item IDs.

Required: true

Sample Request

Path:

POST https://{baseurl}/api-configuration/attribute/get-by-item-ids

Request Body:

{
"itemIds": [
"1000000050",
"1000000033",
"1000011037"
]
}

Response

Success Code: 200

Message: OK

Description: You'll see this message when the attribute details are retrieved for the requested item IDs.

In this sample, the first two items don't have attributes mapped so the "status" is shown as "Error." The code and the message indicates the error reason. Even if the item ID is invalid, the same error is shown.

[
{
"itemId": "1000000050",
"status": "Error",
"code": "ATTRIBUTE_NOT_FOUND_ERROR",
"message": "Attribute Not Found for itemId"
},
{
"itemId": "1000000033",
"status": "Error",
"code": "ATTRIBUTE_NOT_FOUND_ERROR",
"message": "Attribute Not Found for itemId"
},
{
"itemId": "1000011037",
"attributes": [
{
"_id": "6092cba26fe410000872bc62",
"price": "25",
"name": "Gift Wrap",
"type": "bool"
},
{
"_id": "60a77de306f682000975c24c",
"price": "10",
"name": "Gift Message",
"type": "string"
}
]
}
]

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 First updated