Variant API
Request an inventory edit request for a product variation (with webhook notification)
- POST /api/v1/products/variants.json (single product)
- POST /api/v1/products/variants.json (multiple products)
Properties for inventory information¶
| Item name | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| reference_number |
(Required) Control number
You cannot use the same control number. However, if id is entered, it will be given priority in
searching for products, so it is not necessary to enter it.
|
||||||||
|
id |
Product ID
|
||||||||
| variants |
Sales Availability/Stock
Only describe variations that need to be changed. No new variations can be registered.
|
||||||||
| order_quantity |
Total quantity that can be purchased.
Can only be specified if variants include purchase_for_order
|
Important
You need to enter either order_quantity or variants.
Important: About listing status
If the item is out of stock and will be sold out, the listing will be stopped. If more stock is added and the item will be restocked, the status will be "Listed".
POST /api/v1/products/variants.json (single product)¶
Accepts a request to edit the number of items in stock for a particular variation of a product. Only a simple validation of required fields will be performed at request execution time.
API request¶
To change the number of variations
POST /api/v1/products/variants.json
{
"product": {
"reference_number": "ABC0001",
"variants": [
{
"options": [
{ "type": "size", "value": "S" },
{ "type": "color", "value": "White" }
],
"stock_type": "stock_in_hand",
"stocks": 10
},
{
"options": [
{ "type": "size", "value": "S" },
{ "type": "color", "value": "Black" }
],
"stocks": 10
},
{
"options": [
{ "type": "size", "value": "M" },
{ "type": "color", "value": "Black" }
],
"stock_type": "out_of_stock"
}
]
}
}
To change only the total quantity that can be purchased
POST /api/v1/products/variants.json
{
"product": {
"reference_number": "ABC0001",
"order_quantity": 100
}
}
API Response¶
Success¶
HTTP/1.1 201 Created
{
"request_received_at": "2019-09-05T12:10:40.114775+09:00",
"request_uid": "2001909051121040114775174828"
}
|
Item |
Description |
|---|---|
|
request_received_at |
Request received date and time (ISO8601) |
|
request_uid |
request identifier |
failure¶
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"variants": {
"0": {
"stocks": [
"The number of stocks must be entered."
]
}
}
}
}
This will perform simple validation of required fields, etc.
|
Item |
Description |
|---|---|
|
errors |
Error for each input item |
POST /api/v1/products/variants.json (multiple products)¶
You can specify up to 300 different inventories of multiple products in an array.
API Request¶
POST /api/v1/products/variants.json
{
"products": [
{
"reference_number": "ABC0001",
"variants": [
{
"options": [
{ "type": "size", "value": "S" }
{ "type": "color", "value": "White" }
],
"stocks": 10
},
{
"options": [
{ "type": "size", "value": "M" },
{ "type": "color", "value": "White" }
],
"stocks": 5
}
]
},
{
"reference_number": "ABC0002",
"variants": [
{
"options": [
{ "type": "size", "value": "M" },
{ "type": "color", "value": "Black" }
],
"stocks": 20
}
]
}
]
}
API Response¶
Success¶
Batch request identifier returned.
HTTP/1.1 201 Created
{
"request_uid": "202011091162148098276938457",
"request_received_at": "2020-11-09T16:21:48.098276+09:00",
"batch_size": 300
}
|
Item |
Description |
|---|---|
|
request_uid |
request identifier |
|
request_received_at |
Request received date and time (ISO8601) |
|
batch_size |
number of items |
Important: About Batch Requests
Each product in the batch will be issued an individual request ID and notified in the webhook event (product/bulk_variants_update_requested) about the request.
If a validation error occurs, it will be notified in a separate webhook event (product/fail_to_update).
failure¶
The result of validation is returned for each array index.
HTTP/1.1 422 Unprocessable Entity
{
"products": {
"0": {
"errors": {
"variants": {
"0": {
"stocks": [
"The number of stocks must be entered."
]
}
}
}
},
"1": {
"errors": {
"variants": {
"0": {
"stocks": [
"The number of stocks must be entered."
]
}
}
}
}
}
}
This will perform simple validation of required fields, etc.
|
Item |
Description |
|---|---|
|
errors |
Error for each input item |