Skip to main content

Create Stock for Product

POST 

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

Sets the inventory quantity for the specified product.

Request

Responses

Success. Stock was successfully created for product

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/inventories");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"id\": \"00000000-0000-0000-0000-000000000000\",\n \"type\": \"stock\",\n \"attributes\": {\n \"available\": 20,\n \"locations\": {\n \"york_warehouse\": {\n \"available\": 10\n },\n \"stevenage_warehouse\": {\n \"available\": 20\n }\n }\n }\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
Body
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "type": "stock",
    "attributes": {
      "available": 20,
      "locations": {
        "york_warehouse": {
          "available": 10
        },
        "stevenage_warehouse": {
          "available": 20
        }
      }
    }
  }
}
ResponseClear

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