inventoryItem
Version 2024-01-01
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
Overview
Returns an inventory item using a Buy With Prime inventory identifier.
Required scope(s)
View inventory data
Response
Return type InventoryItem
Arguments
Argument | Description |
---|---|
inventoryItemId (String required) | Identifier for the InventoryItem. The size should be greater than or equal to 1 and less than or equal to 14. |
Examples
Query Inventory Item With Valid Identifier
Request
query {
inventoryItem(inventoryItemId: "abcdef01234567") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"data": {
"inventoryItem": {
"inventoryItemId": "abcdef01234567",
"buyableQuantity": {
"unit": "UNIT",
"amount": 10
}
}
}
}
Query Inventory Item With No Valid Sku
Request
query {
inventoryItem(inventoryItemId: "abcdefzzzzzzzz") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"errors": [
{
"message": "The buyable quantity cannot be determined because this item is associated with an invalid MSKU.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"inventoryItem"
],
"extensions": {
"classification": {
"errorType": "ValidationException",
"errorCode": 400,
"type": "ValidationError",
"code": "InvalidAmazonSkuConfiguration",
"details": {
"message": "The buyable quantity cannot be determined because this item is associated with an invalid MSKU."
}
}
}
}
],
"data": {
"inventoryItem": {
"inventoryItemId": "abcdefzzzzzzzz",
"buyableQuantity": null
}
}
}
Query Inventory Item With No Sku
Request
query {
inventoryItem(inventoryItemId: "abcdefyyyyyyyy") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"errors": [
{
"message": "The buyable quantity cannot be determined because this item is not associated with an MSKU.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"inventoryItem"
],
"extensions": {
"classification": {
"errorType": "ValidationException",
"errorCode": 400,
"type": "ValidationError",
"code": "MissingAmazonSkuConfiguration",
"details": {
"message": "The buyable quantity cannot be determined because this item is not associated with an MSKU."
}
}
}
}
],
"data": {
"inventoryItem": {
"inventoryItemId": "abcdefyyyyyyyy",
"buyableQuantity": null
}
},
"extensions": {}
}
Query Inventory Item With Invalid Identifier
Request
query {
inventoryItem(inventoryItemId: "invalid-identifier") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"errors": [
{
"message": "Input request is not valid, the following issues were encountered: [/inventoryItem/inventoryItemId must match \\\"^[a-zA-Z0-9]+$\\\"]",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"inventoryItem"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "UnspecifiedError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": {
"inventoryItem": null
}
}
Query Inventory Item With Identifier Exceeding Length
Request
query {
inventoryItem(inventoryItemId: "abcdef01234567xxx") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"errors": [
{
"message": "Input request is not valid, the following issues were encountered: [/inventoryItem/inventoryItemId size must be between 1 and 14]",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"inventoryItem"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "UnspecifiedError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": {
"inventoryItem": null
}
}
Query Inventory Item Which Does Not Exist
Request
query {
inventoryItem(inventoryItemId: "abcdefxxxxxxxx") {
inventoryItemId
buyableQuantity {
unit
amount
}
}
}
Response
{
"errors": [
{
"message": "Request references a resource which does not exist.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"inventoryItem"
],
"extensions": {
"classification": {
"errorType": "ResourceNotFoundException",
"errorCode": 404,
"type": "ResourceNotFoundError"
}
}
}
],
"data": {
"inventoryItem": null
}
}
Updated 2 days ago