Skip to main content

Create Stock for Product

POST 

https://euwest.api.elasticpath.com/v2/inventories/:product_uuid

Sets the inventory quantity for the specified product. When you take this action, you are choosing to manage the inventory for this product in Commerce.

Request

Path Parameters

    product_uuid UUIDrequired

    The unique identifier of the product.

Body

    data InventoryCreaterequired
    quantityinteger

    The amount of inventory available.

    Example: 5

Responses

Success. Stock was successfully created for product

Schema
    data Inventory
    idstringrequired

    The unique identifier of the product.

    Example: f976dace-450f-4a5d-8877-d119c5a550a1
    stock_idstring

    The Stock ID of a product, or empty if the product ID matches the Stock ID

    Example: ce9049af-bba2-4db2-8118-5df5268184c7
    typestringrequired

    The type represents the object being returned. Always stock.

    Possible values: [stock]

    Default value: stock
    Example: stock
    totalint64required

    The total amount of stock we have.

    Example: 100
    availableint64required

    The amount of stock available for purchase.

    Example: 75
    allocatedint64required

    The amount of paid for stock, also known as reserved.

    Example: 25
    meta Meta
    updated_atstring

    The date and time a resource was updated.

    Example: 2017-01-10T11:41:19.244842Z
    created_atstring

    The date and time a resource was created.

    Example: 2017-01-10T11:41:19.244842Z

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/inventories/:product_uuid");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"quantity\": 5\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com/v2
Auth
Parameters
— pathrequired
Body
{
  "data": {
    "quantity": 5
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.