【Shopify.dev和訳】Admin API/GraphQL reference/Inventory
この記事について
この記事は、Admin API/GraphQL reference/Inventoryの記事を和訳したものです。
Shopify アプリのご紹介
Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。
Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。
Inventory APIs
複数の拠点の在庫レベルを管理するための API です。
Overview
-
CountryHarmonizedSystemCode - 国別整合性のあるシステムコードと国別 ISO コードを保持します。
-
CountryHarmonizedSystemCodeInput - 国別の整合化されたシステムコードと国別の ISO コードが格納されます。
-
InventoryAdjustItemInput - 在庫とその調整内容を指定します。
-
InventoryAdjustQuantityInput - 在庫数量の調整に必要なフィールドを指定します。
-
InventoryItem - 顧客への出荷が可能な商品を表します。SKU やトラッキングの有無など、商品に関する重要な情報を保持します。
-
InventoryItemInput - インベントリアイテム(在庫)です。
-
InventoryItemUpdateInput - インベントリアイテム(在庫)です。
-
InventoryLevel - 特定の場所にある在庫量を表します。
-
InventoryLevelInput - 特定の場所の在庫量を表します。
-
InventoryActivate - 特定の場所の在庫をアクティブにします。
-
InventoryAdjustQuantity - 特定の数量で在庫を調整します。
-
inventoryBulkAdjustQuantityAtLocation - 複数の在庫に対して、ある場所の在庫を調整します。
-
inventoryDeactivate - ある場所の在庫を非アクティブにします。
-
inventoryItemUpdate - 在庫を更新します。
Objects
CountryHarmonizedSystemCode
(object
)
v,2021-07
国別調和システムコードと国別 ISO コードを保持します。
Fields
countryCode
(CountryCode!
)
国の ISO コード
harmonizedSystemCode
(String!
)
国別の整合性のあるシステムコード
CountryHarmonizedSystemCode の返す型
複数の CountryHarmonizedSystemCodes
をページングするために自動生成されたタイプです。
Fieds
edges
([CountryHarmonizedSystemCodeEdge!]!
)
edge のリスト。
pageInfo
(PageInfo!
)
ページネーションを補助するための情報。
自動生成されたタイプで、ページネーションの際に 1 つの CountryHarmonizedSystemCode とカーソルを保持します。
Fields
curosr
(String!
)
node
(CountryHarmonizedSystemCode!
)
CountryHarmonizedSystemCodeEdge の末尾の項目です。
CountryHarmonizedSystemCodeEdge を返す型
InventoryItem
(object
)
顧客への出荷が可能な商品を表しています。SKU やトラッキングの有無など、商品に関する重要な情報を保持しています。
Connections
countryHarmonizedSystemCodes
(CountryHarmonizedSystemCodeConnection!
)
国別整合性のあるシステムコードの一覧です。
引数 | 説明 |
---|---|
after (String ) |
指定されたカーソルの後に来る要素を返します。 |
before (String ) |
指定されたカーソルの前に来る要素を返します。 |
first (Int ) |
リストから最初のn 個までの要素を返します。 |
last (Int ) |
リストの最後のn 個までの要素を返します。 |
reverse (Boolean ) |
基礎となるリストの順序を逆にします。 初期値は false です。 |
inventoryLevels
(InventoryLevelConnection!
)
在庫アイテムがストックされている各ロケーションの在庫レベルのページングされたリスト。
引数 | 説明 |
---|---|
after ( String ) |
指定されたカーソルの後に来る要素を返します。 |
before ( String ) |
指定されたカーソルより前にある要素を返します。 |
first ( Int ) |
リストから最初の n 個の要素までを返します。 |
last ( Int ) |
リストから最後の n 個の要素までを返します。 |
query ( String ) |
サポートされているフィルタパラメータです。 ・ created_at ・ INVENTORY_GROUP_ID ・ INVENTORY_ITEM_ID ・ updated_at フィルターの使用に関する詳細は、詳細な search syntax を参照してください。 |
reverse ( Boolean ) |
基礎となるリストの順序を逆にします。 デフォルト値: false
|
Fields
countryCodeOfOrigin
(CountryCode
)
原産国の ISO コード
createdAt
(DateTime!
)
InventoryItem が作成された日時です。
duplicateSkuCount
(Int!
)
このアイテムと同じ SKU を共有する InventoryItem の数。
harmonizedSystemCode
(String
)
アイテムの調和されたシステムコードです。
id
(ID!
)
グローバルに一意な識別子。
inventoryHistoryUrl
(URL
)
Inventory 履歴の Web ページの URL。
inventoryLevel
(InventoryLevel
)
特定の場所の Inventory level を取得します。
引数 | 説明 |
---|---|
locationId ( ID! ) required
|
インベントリレベルを要求されたロケーションの ID。 |
legacyResourceId
(UnsignedInt64!
)
REST Admin API の対応するリソースの ID。
locationsCount
(Int!
)
この在庫アイテムがストックされているロケーションの数。
provinceCodeOfOrigin
(String
)
原産国の ISO コード。
requiresShipping
(Boolean!
)
この商品が配送を必要とするかどうか。
sku
(String
)
在庫アイテムの SKU。
tracked
(Boolean!
)
アイテムの在庫レベルの在庫量を追跡するかどうか。
trackedEditable
(EditableProperty!
)
インベントリアイテムの tracked 属性への変更が許可されているかどうか。
unitCost
(MoneyV2
)
在庫アイテムに関連するユニットコスト。
updatedAt
(DateTime!
)
インベントリアイテムが更新された日付と時間。
variant
(ProductVariant!
)
このインベントリアイテムを所有するバリアント。
InventoryItem が返す型
InventoryItem の Mutations
inventoryItemUpdate
Inventory Item の更新
Implements
複数の InventoryItem をページングするための自動生成タイプ
FIelds
cursor
(String!
)
ページネーションに使用するカーソル
node
(InventoryItem!
)
InventoryItemEdge の最後にあるアイテム
InventoryItemEdge の返す型
Samples
# inventory items の初めの ID10個
{
inventoryItems(first:10) {
edges {
node {
id
}
}
}
}
{
"data": {
"inventoryItems": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryItem/19848949301270"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949334038"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949366806"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949399574"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949432342"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949465110"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949497878"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949530646"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949563414"
}
},
{
"node": {
"id": "gid://shopify/InventoryItem/19848949596182"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 12,
"actualQueryCost": 12,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 969,
"restoreRate": 50
}
}
}
}
InventoryLevel
(object
)
特定の場所にある在庫アイテムの在庫量を表す。
Fields
available!
(Int!
)
その場所で利用可能なアイテムの数量。
canDeactivate
(Boolean!
)
この在庫レベルで InventoryDeactivate が許可されているかどうか。
createdAt
(DateTime!
)
inventory level が作成された日付と時間。
deactivationAlert
(String
)
canDeactivate が false の理由、または inventory level を非アクティブにすることの影響。
deactivationAlertHtml
(FormattedString
)
HTML でリンクされた URL で canDeactivate が false になる理由、または inventory level を無効にすることによる影響。
id
(ID!
)
グローバルに一意な識別子。
incoming
(Int!
)
その場所に入ってくるアイテムの数量。
item
(InventoryItem!
)
在庫レベルに関連する在庫アイテム。
location
(Location!
)
inventory level に関連付けられたロケーション。
updatedAt
(DateTime!
)
inventory level が更新された日付と時間。
InventoryLevel の返す型
InventoryItem.InventoryLevel
InventoryItem.inventoryLevels
Location.InventoryLevel
Location.InventoryLevels
QueryRoot.inventoryLevel
Implements
-
Node
複数のInventoryLevels
をページングするために自動生成されたタイプです。
Fields
edges
([InventoryLevelEdge!]!
)
edges のリスト
pageInfo
(PageInfo!
)
ページネーションに役立つ情報です。
自動生成されたタイプで、1 つの InventoryLevel とページネーション時のカーソルを保持します。
このセクションについて
Fields
cursor
(String!
)
ページネーションで使用されるカーソルです。
node
(InventoryLevel!
)
InventoryLevelEdge の最後にある項目
InventoryLevelEdge の返す型
Samples
# 最初の 10 inventory levelsを取得する
{
inventoryItems(first:10) {
edges {
node {
inventoryLevels(first:10) {
edges {
node {
id
}
}
}
}
}
}
}
{
"data": {
"inventoryItems": {
"edges": [
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949301270"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949334038"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949366806"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949399574"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949432342"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949465110"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949497878"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949530646"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949563414"
}
}
]
}
}
},
{
"node": {
"inventoryLevels": {
"edges": [
{
"node": {
"id": "gid://shopify/InventoryLevel/17001775126?inventory_item_id=19848949596182"
}
}
]
}
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 132,
"actualQueryCost": 42,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 958,
"restoreRate": 50
}
}
}
}
mutation
)
inventoryActivate(例
これは mutation query の例です。
mutation inventoryActivate($inventoryItemId: ID!, $locationId: ID!) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {
inventoryLevel {
id
}
userErrors {
field
message
}
}
}
{
"inventoryItemId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
"locationId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE="
}
引数
引数 | 説明 |
---|---|
available (Int ) |
その場所での最初の利用可能な数量です。 |
inventoryItemId (ID! ) required
|
どのアイテムをアクティブにするかを指定します。 |
locationId (ID! ) required
|
そのアイテムがどこでアクティベートされるべきかを指定します |
Return fields
-
inventoryLevel
(InventoryLevel
)
新しく有効になった inventory level です。 -
userErrors
([UserError!]!
)
mutation を実行して発生したエラーのリストです。
mutation
)
inventoryAdjustQuantity(インベントリを一定量だけ調整します。
example
mutation query の例です。
mutation inventoryAdjustQuantity($input: InventoryAdjustQuantityInput!) {
inventoryAdjustQuantity(input: $input) {
inventoryLevel {
id
}
userErrors {
field
message
}
}
}
{
"input": {
"inventoryLevelId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
"availableDelta": 1
}
}
引数
引数 | 説明 |
---|---|
input ( InventoryAdjustQuantityInput! ) required
|
インベントリレベルの更新に必要な入力フィールドを提供します |
InventoryAdjustQuantityInput
fields
availableDelta
(Int!
) required
利用可能な数量を調整するためのカウント数。
inventoryLevelId
(ID!
) required
調整する在庫レベルの ID です。
Return fields
inventoryLevel
(InventoryLevel
)
特定の場所にあるインベントリアイテムの更新された在庫量を表します。
userErrors
([UserError!]!
)
mutation を実行して発生したエラーのリストです。
inventoryBulkAdjustQuantityAtLocation
(mutation
)
複数の在庫アイテムに対して、ある場所の在庫を調整します。
example
mutation query の実行例です。
mutation inventoryBulkAdjustQuantityAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!, $locationId: ID!) {
inventoryBulkAdjustQuantityAtLocation(
inventoryItemAdjustments: $inventoryItemAdjustments
locationId: $locationId
) {
inventoryLevels {
id
}
userErrors {
field
message
}
}
}
{
"inventoryItemAdjustments": [
{
"inventoryItemId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
"availableDelta": 1
}
],
"locationId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE="
}
引数
引数 | 説明 |
---|---|
inventoryItemAdjustments ( [InventoryAdjustItemInput!]! ) required
|
アイテムの調整を指定します。 |
locationId ( ID! ) required
|
アイテムを調整する場所を指定します。 |
InventoryAdjustItemInput
fields
availableDelta
(Int!
) required
利用可能な数量を調整するためのカウント数。
inventoryItemId
(ID!
) required
調整するインベントリアイテムの ID。
Return fields
inventoryLevels
([InventoryLevel!]
)
更新された在庫量。
userErrors
([UserError!]!
)
mutation を実行した際に発生したエラーのリスト。
inventoryDeactivate
(mutation
)
ある場所のインベントリーアイテムを無効にする。
例
mutation query を実行した例です。
mutation inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
field
message
}
}
}
{
"inventoryLevelId": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE="
}
引数
引数 | 説明 |
---|---|
inventoryLevelId (ID! ) required
|
どのインベントリレベルを無効にするかを指定します。 |
Return fields
userErrors
([UserError!]!
)
mutation を実行した際に発生したエラーのリスト。
inventoryItemUpdate
(mutation
)
インベントリアイテムを更新します。
例
mutation query を実行した例です。
mutation inventoryItemUpdate($id: ID!, $input: InventoryItemUpdateInput!) {
inventoryItemUpdate(id: $id, input: $input) {
inventoryItem {
id
}
userErrors {
field
message
}
}
}
{
"id": "Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=",
"input": {}
}
引数
引数 | 説明 |
---|---|
id (ID!
|
更新するインベントリーアイテムの ID |
input (InventoryItemUpdateInput! ) required
|
インベントリアイテムの更新されたプロパティです。 |
InventoryItemUpdateInput
fields
cost
Decimal
)
インベントリアイテムに関連する単価。通貨はショップのデフォルト通貨。
countryCodeOfOrigin
(CountryCode
)
原産国の ISO コード。
countryHarmonizedSystemCodes
([CountryHarmonizedSystemCodeInput!]
)
国別調和システムコードのリスト。
harmonizedSystemCode
([String]
)
インベントリアイテムのハーモナイズドシステムコード。
provinceCodeOfOrigin
(String
)
原産国の ISO コード
tracked
(Boolean
)
インベントリアイテムが追跡されているかどうか。
Return fields
inventoryItem
(InventoryItem
)
更新されたインベントリアイテムです。
userErrors
([UserError!]!
)
mutation を実行して発生したエラーのリストです。
Inputs
CountryHarmonizedSystemCodeInput
(input
)
国別調和システムコードと国別 ISO コードを保持します。
入力フィールド
countryCode
(CountryCode!
) required
国の ISO コードです。
harmonizedSystemCode
(String!
) required
国別の整合性のあるシステムコード
InventoryAdjustItemInput
(input
)
アイテムとその調整方法を指定します。
入力フィールド
availableDelta
(Int!
) required
利用可能な数量を調整するためのカウント数。
inventoryItemId
(ID!
) required
調整するインベントリアイテムの ID です。
InventoryAdjustQuantityInput
(input
)
在庫量の調整に必要なフィールドを指定します。
入力フィールド
availableDelta
(Int!
) required
利用可能な数量を調整するためのカウント数。
inventoryLevelId
(ID!
) required
調整する在庫レベルの ID。
InventoryItemInput
(input
)
インベントリアイテム
Input fileds
cost
(Decimal
)
インベントリアイテムに関連する単価、通貨はショップのデフォルト通貨。
tracked
(Boolean
)
インベントリアイテムが追跡されているかどうか。
InventoryItemUpdateInput
(input
)
インベントリアイテム
入力フィールド
cost
(Decimal
)
インベントリアイテムに関連する単価。通貨はショップのデフォルト通貨。
countryCodeOfOrigin
(CountryCode
)
原産国の ISO コード。
countryHarmonizedSystemCodes
([CountryHarmonizedSystemCodeInput!]
)
国別調和システムコードのリスト。
harmonizedSystemCode
(String
)
インベントリアイテムのハーモナイズドシステムコード。
provinceCodeOfOrigin
(String
)
原産国の ISO コード
tracked
(Boolean
)
インベントリアイテムが追跡されているかどうか。
InventoryLevelInput
(input
)
特定の場所での在庫量
入力フィールド
AvailableQuantity
(Int!
) required
その場所で利用可能な数量を設定します。
locationId
(ID!
) required
ロケーションの ID です。
Shopify アプリのご紹介
Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。
Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。
Discussion