Zoey REST API reference ยท Interactive version: apidocs.zoey.com

Catalog

Catalog: Inventory

Allows you to manage existing stock items. Inventory management is available only for Admin.

Locations

Get

GET https://container-url.zoeysite.com/api/rest/inventory/location?id=1

Query parameters:

NameExampleNotes
id1

Example response (Get Inventory Location):

{
    "addresses": [
        {
            "address_id": "1",
            "location_id": "1",
            "firstname": "Zoey",
            "lastname": "Developer",
            "email": null,
            "street": "123 Main St.\r\nFloor 10",
            "city": "New York",
            "postcode": "10019",
            "region_id": "43",
            "region": "New York",
            "country_id": "US",
            "telephone": "555-555-5555",
            "fax": null,
            "created_at": "2022-09-29 00:00:00",
            "updated_at": "2022-09-29 00:00:00",
            "full_address": "Zoey Developer, 123 Main St. Floor 10, New York, New York 10019, United States"
        }
    ],
    "created_at": "2022-09-20 22:27:26",
    "customer_groups": [
        "1",
        "2",
        "3"
    ],
    "is_enabled": 1,
    "location_id": 1,
    "location_name": "Zoey Inventory Location",
    "products": {
        "41286": {
            "qty": 11
        },
        "41287": {
            "qty": 812
        }
    },
    "show_qty": 1,
    "updated_at": "2022-10-20 23:38:48"
}

Get All

GET https://container-url.zoeysite.com/api/rest/inventory/locations?product_id=68711

Query parameters:

NameExampleNotes
product_id68711(Optional) Filter by Product

Example response (List Inventory Locations):

[
    {
        "addresses": [
            {
                "address_id": "1",
                "location_id": "1",
                "firstname": "Zoey",
                "lastname": "Developer",
                "email": null,
                "street": "123 Main St.\r\nFloor 10",
                "city": "New York",
                "postcode": "10019",
                "region_id": "43",
                "region": "New York",
                "country_id": "US",
                "telephone": "555-555-5555",
                "fax": null,
                "created_at": "2022-09-29 00:00:00",
                "updated_at": "2022-09-29 00:00:00",
                "full_address": "Zoey Developer, 123 Main St. Floor 10, New York, New York 10019, United States"
            }
        ],
        "created_at": "2022-09-20 22:27:26",
        "customer_groups": [
            "1",
            "2",
            "3"
        ],
        "is_enabled": 1,
        "location_id": 1,
        "location_name": "Zoey Inventory Location",
        "products": {
            "41286": {
                "qty": 11
            },
            "41287": {
                "qty": 812
            }
        },
        "show_qty": 1,
        "updated_at": "2022-10-20 23:38:48"
    },
    {
        "addresses": [
            {
                "address_id": "4",
                "location_id": "2",
                "firstname": "Zoey",
                "lastname": "Developer",
                "email": null,
                "street": "111 Main St",
                "city": "New York",
                "postcode": "10019",
                "region_id": "43",
                "region": "New York",
                "country_id": "US",
                "telephone": "555-555-5555",
                "fax": null,
                "created_at": "2022-09-29 00:00:00",
                "updated_at": "2022-09-29 00:00:00",
                "full_address": "Zoey Developer, 111 Main St, New York, New York 10019, United States"
            }
        ],
        "created_at": "2022-10-20 23:41:14",
        "customer_groups": [
            "0"
        ],
        "is_enabled": 1,
        "location_id": 2,
        "location_name": "Zoey Secondary Location",
        "products": {
            "41277": {
                "qty": 1
            }
        },
        "show_qty": 1,
        "updated_at": "2022-10-20 23:41:14"
    }
]

Create

POST https://container-url.zoeysite.com/api/rest/inventory/location

Example request body:

[
    {
        "location_name": "Inventory Location Name",
        "is_enabled": 1,
        "show_qty": 1,
        "customer_groups": [
            1,
            2
        ],
        "products": {
            "1": {
                "qty": 1
            },
            "2": {
                "qty": 20
            },
            "3": {
                "qty": 300
            }
        }
    }
]

Example response (Create Inventory Location):

{
    "addresses": [],
    "created_at": "2022-10-20 23:53:33",
    "customer_groups": [
        "1",
        "2"
    ],
    "is_enabled": 1,
    "location_id": 1,
    "location_name": "Inventory Location Name",
    "products": {
        "1": {
            "qty": 1
        },
        "2": {
            "qty": 20
        },
        "3": {
            "qty": 300
        }
    },
    "show_qty": 1,
    "updated_at": "2022-10-20 23:53:33"
}

Update

PUT https://container-url.zoeysite.com/api/rest/inventory/location

Example request body:

{
    "id": 1,
    "data": {
        "location_name": "Inventory Location Name",
        "is_enabled": 1,
        "show_qty": 0,
        "customer_groups": [
            1,
            2,
            3
        ],
        "products": {
            "1": {
                "qty": 1
            },
            "2": {
                "qty": 2
            },
            "3": {
                "qty": 321
            }
        }
    }
}

Get All

GET https://container-url.zoeysite.com/api/rest/stockitems?page=1&limit=10

Allows you to retrieve the list of existing stock items.

The attributes that will be returned for stock items is configured in the Zoey Admin

Query parameters:

NameExampleNotes
page1Used to set page for pagination. (optional)
limit10Used to set limit for pagination. (optional)

Example response (GetAll), HTTP 200:

[
    {
        "item_id": "249",
        "product_id": "105",
        "qty": "0.0000"
    },
    {
        "item_id": "250",
        "product_id": "106",
        "qty": "998.0000"
    },
    {
        "item_id": "251",
        "product_id": "107",
        "qty": "100.0000"
    },
    {
        "item_id": "252",
        "product_id": "108",
        "qty": "99.0000"
    },
    {
        "item_id": "255",
        "product_id": "111",
        "qty": "4.0000"
    },
    {
        "item_id": "256",
        "product_id": "112",
        "qty": "97.0000"
    },
    {
        "item_id": "257",
        "product_id": "113",
        "qty": "96.0000"
    },
    {
        "item_id": "258",
        "product_id": "114",
        "qty": "70.0000"
    },
    {
        "item_id": "259",
        "product_id": "115",
        "qty": "982.0000"
    },
    {
        "item_id": "260",
        "product_id": "116",
        "qty": "0.0000"
    }
]

Update All

PUT https://container-url.zoeysite.com/api/rest/stockitems

Allows you to update multiple existing stock items at once.

Example request body:

[
    {
        "item_id": "252",
        "qty": "98"
    },
    {
        "item_id": "472",
        "qty": "98"
    }
]

Example response (Update All), HTTP 207:

{
    "success": [
        {
            "item_id": "252",
            "message": "Resource updated successful.",
            "code": 200
        }
    ],
    "error": [
        {
            "item_id": "472",
            "message": "There is no Inventory on a Configurable Product, you need to update its variations.",
            "code": 400
        }
    ]
}

Get

GET https://container-url.zoeysite.com/api/rest/stockitems/:stockItem

Allows you to retrieve the stock item information.

The list of attributes that will be returned for stock items is configured in the Zoey Admin Panel.

Example response (Get), HTTP 200:

{
    "backorders": "0",
    "enable_qty_increments": "0",
    "is_decimal_divided": "1",
    "is_in_stock": "1",
    "is_qty_decimal": "1",
    "item_id": "252",
    "low_stock_date": null,
    "manage_stock": "0",
    "max_sale_qty": "0.0000",
    "min_qty": "0.0000",
    "min_sale_qty": "1.0000",
    "notify_stock_qty": "10.0000",
    "product_id": "1",
    "qty": "200.0000",
    "qty_increments": "0.0000",
    "stock_id": "1",
    "stock_status_changed_auto": "0",
    "use_config_backorders": "1",
    "use_config_enable_qty_inc": "1",
    "use_config_manage_stock": "1",
    "use_config_max_sale_qty": "1",
    "use_config_min_qty": "1",
    "use_config_min_sale_qty": "1",
    "use_config_notify_stock_qty": "0",
    "use_config_qty_increments": "1"
}

Update

PUT https://container-url.zoeysite.com/api/rest/stockitems/:stockItem

Allows you to update existing stock item data.

Parameters - Enter only those parameters which you want to update.

Name Description Type Example Value
item_id Item ID int 1
product_id Product ID int 1
stock_id Stock ID int 1
qty Quantity of stock items for the current product int float
min_qty Quantity for stock items to become out of stock int float
use_config_min_qty Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option int 1
is_qty_decimal Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) int 0
backorders The customer can place the order for products that are out of stock at the moment (0 - No Backorders, 1 - Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer) int 0
use_config_backorders Choose whether the Config settings will be applied for the Backorders option int 1
min_sale_qty Minimum number of items in the shopping cart to be sold int float
use_config_min_sale_qty Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option int 0
max_sale_qty Maximum number of items in the shopping cart to be sold int float
use_config_max_sale_qty Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option int 0
is_in_stock Defines whether the product is available for selling (0 - Out of Stock, 1 - In Stock) int 1
low_stock_date Date when the number of stock items became lower than the number defined in the Notify for Quantity Below option string 2020-02-14 12:37:51
notify_stock_qty The number of inventory items below which the customer will be notified via the RSS feed int float
use_config_notify_stock_qty Choose whether the Config settings will be applied for the Notify for Quantity Below option int 0
manage_stock Choose whether to view and specify the product quantity and availability and whether the product is in stock management( 0 - No, 1 - Yes) int 0
use_config_manage_stock Choose whether the Config settings will be applied for the Manage Stock option int 1
stock_status_changed_auto Defines whether products can be automatically returned to stock when the refund for an order is created int 0
use_config_qty_increments Choose whether the Config settings will be applied for the Enable Qty Increments option int 1
qty_increments The product quantity increment value int float
use_config_enable_qty_inc Choose whether the Config settings will be applied for the Qty Increments option int 1
enable_qty_increments Defines whether the customer can add products only in increments to the shopping cart int 0
is_decimal_divided Defines whether the stock items can be divided into multiple boxes for shipping int 0

Example request body:

{
    "qty": 6,
    "is_in_stock": 1
}

Delete

DELETE N/A

NOT ALLOWED

The DELETE method is not allowed because you cannot delete a stock item. The required stock item is deleted together with the product which it is associated to.

Example response (Get), HTTP 200:

{
    "backorders": "0",
    "enable_qty_increments": "0",
    "is_decimal_divided": "1",
    "is_in_stock": "1",
    "is_qty_decimal": "1",
    "item_id": "252",
    "low_stock_date": null,
    "manage_stock": "0",
    "max_sale_qty": "0.0000",
    "min_qty": "0.0000",
    "min_sale_qty": "1.0000",
    "notify_stock_qty": "10.0000",
    "product_id": "1",
    "qty": "200.0000",
    "qty_increments": "0.0000",
    "stock_id": "1",
    "stock_status_changed_auto": "0",
    "use_config_backorders": "1",
    "use_config_enable_qty_inc": "1",
    "use_config_manage_stock": "1",
    "use_config_max_sale_qty": "1",
    "use_config_min_qty": "1",
    "use_config_min_sale_qty": "1",
    "use_config_notify_stock_qty": "0",
    "use_config_qty_increments": "1"
}