Create Stock Transaction on Product
POSThttps://euwest.api.elasticpath.com/v2/inventories/:product_uuid/transactions
Create Stock Transaction on Product
Request
Path Parameters
product_uuid UUIDrequired
The unique identifier of the product.
- application/json
Body
data TransactionCreaterequired
Responses
- 200
- 404
- 422
- 500
Success. Stock was successfully modified for product
- application/json
- Schema
- Example (auto)
Schema
data Transaction
{
"data": {
"id": "f976dace-450f-4a5d-8877-d119c5a550a1",
"type": "stock-transaction",
"action": "allocate",
"product_id": "86b84d3e-0a86-43d6-a347-78ba4adacca2",
"quantity": 5,
"timestamps": {
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z"
}
}
}
Not found. The requested entity does not exist.
- application/json
- Schema
- Example (auto)
- not-found
Schema
errors object[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Not Found",
"status": "404",
"detail": "No stock found"
}
]
}
The request was understood, but could not be processed by the server
- application/json
- Schema
- Example (auto)
- missing-name
Schema
errors object[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Cannot complete request",
"status": "422",
"detail": "Your request could not be completed due to insufficient stock levels"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (auto)
- internal-server-error
Schema
errors object[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": "500"
}
]
}
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/:product_uuid/transactions");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"product_id\": \"b9ad64bd-fc21-4918-b6ec-768809f4a1e9\",\n \"type\": \"stock-transaction\",\n \"action\": \"allocate\",\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());
ResponseClear