Create a Location
POSThttps://euwest.api.elasticpath.com/v2/inventories/locations
Creates an Inventory Location
Request
Responses
- 201
- 400
Success. The location was created successfully
Bad request. The request failed validation.
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/inventories/locations");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"inventory_location\",\n \"attributes\": {\n \"name\": \"Milton Keynes Warehouse\",\n \"external_ref\": \"mk-stock-warehouse-walnut-tree\",\n \"slug\": \"milton-keynes-warehouse\",\n \"description\": \"Southern dispatch location for all inventory\",\n \"address\": [\n \"string\"\n ],\n \"geolocation\": {\n \"lat\": 51.477928,\n \"lon\": -0.001545\n }\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear