inventoryItem
Version 2024-04-01
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": {
"type": "ValidationError",
"code": "InvalidAmazonSkuConfiguration",
"details": {
"message": "The buyable quantity cannot be determined because this item is associated with an invalid MSKU."
},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"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": {
"type": "ValidationError",
"code": "MissingAmazonSkuConfiguration",
"details": {
"message": "The buyable quantity cannot be determined because this item is not associated with an MSKU."
},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"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 23 days ago