curl --request PATCH \
--url https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-CompanyID: <x-companyid>' \
--header 'X-UserID: <x-userid>' \
--data '
{
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
}
'using RestSharp;
var options = new RestClientOptions("https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-UserID", "<x-userid>");
request.AddHeader("X-CompanyID", "<x-companyid>");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"WarehouseId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"MinStock\": 10,\n \"MaxStock\": 500,\n \"MaxStockControl\": 1,\n \"MinStockControl\": 1,\n \"NegativeStockControl\": 2\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'PATCH',
headers: {
'X-UserID': '<x-userid>',
'X-CompanyID': '<x-companyid>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
WarehouseId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
MinStock: 10,
MaxStock: 500,
MaxStockControl: 1,
MinStockControl: 1,
NegativeStockControl: 2
})
};
fetch('https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}"
payload = {
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
}
headers = {
"X-UserID": "<x-userid>",
"X-CompanyID": "<x-companyid>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"Success": true,
"ResultCode": "0000",
"Data": {
"Id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ProductId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"WarehouseName": "A DEPO",
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
},
"Message": "<string>"
}{
"Success": false,
"ResultCode": "2410",
"Message": "A critical stock definition cannot be added for a product with StockType 1 (no stock tracking).",
"Errors": [
{
"Code": "2410",
"Message": "A critical stock definition cannot be added for a product with StockType 1 (no stock tracking)."
}
]
}{
"Success": false,
"ResultCode": "0102",
"Message": "Token has expired. Obtain a new token using the refresh token.",
"Errors": [
{
"Code": "0102",
"Message": "Token has expired. Obtain a new token using the refresh token."
}
]
}{
"Success": false,
"ResultCode": "0110",
"Message": "You do not have permission for this operation.",
"Errors": [
{
"Code": "0110",
"Message": "You do not have permission for this operation."
}
]
}{
"Success": false,
"ResultCode": "2000",
"Message": "Product not found.",
"Errors": [
{
"Code": "2000",
"Message": "Product not found."
}
]
}{
"Success": false,
"ResultCode": "0120",
"Message": "Daily request limit (10000) exceeded.",
"Errors": [
{
"Code": "0120",
"Message": "Daily request limit (10000) exceeded."
}
]
}Partially update critical stock definition
Changes only the sent fields of the definition.
curl --request PATCH \
--url https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-CompanyID: <x-companyid>' \
--header 'X-UserID: <x-userid>' \
--data '
{
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
}
'using RestSharp;
var options = new RestClientOptions("https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-UserID", "<x-userid>");
request.AddHeader("X-CompanyID", "<x-companyid>");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"WarehouseId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"MinStock\": 10,\n \"MaxStock\": 500,\n \"MaxStockControl\": 1,\n \"MinStockControl\": 1,\n \"NegativeStockControl\": 2\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'PATCH',
headers: {
'X-UserID': '<x-userid>',
'X-CompanyID': '<x-companyid>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
WarehouseId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
MinStock: 10,
MaxStock: 500,
MaxStockControl: 1,
MinStockControl: 1,
NegativeStockControl: 2
})
};
fetch('https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.noyax.com/api/v1/products/{productId}/critical-stock/{criticalStockId}"
payload = {
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
}
headers = {
"X-UserID": "<x-userid>",
"X-CompanyID": "<x-companyid>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"Success": true,
"ResultCode": "0000",
"Data": {
"Id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ProductId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"WarehouseName": "A DEPO",
"WarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"MinStock": 10,
"MaxStock": 500,
"MaxStockControl": 1,
"MinStockControl": 1,
"NegativeStockControl": 2
},
"Message": "<string>"
}{
"Success": false,
"ResultCode": "2410",
"Message": "A critical stock definition cannot be added for a product with StockType 1 (no stock tracking).",
"Errors": [
{
"Code": "2410",
"Message": "A critical stock definition cannot be added for a product with StockType 1 (no stock tracking)."
}
]
}{
"Success": false,
"ResultCode": "0102",
"Message": "Token has expired. Obtain a new token using the refresh token.",
"Errors": [
{
"Code": "0102",
"Message": "Token has expired. Obtain a new token using the refresh token."
}
]
}{
"Success": false,
"ResultCode": "0110",
"Message": "You do not have permission for this operation.",
"Errors": [
{
"Code": "0110",
"Message": "You do not have permission for this operation."
}
]
}{
"Success": false,
"ResultCode": "2000",
"Message": "Product not found.",
"Errors": [
{
"Code": "2000",
"Message": "Product not found."
}
]
}{
"Success": false,
"ResultCode": "0120",
"Message": "Daily request limit (10000) exceeded.",
"Errors": [
{
"Code": "0120",
"Message": "Daily request limit (10000) exceeded."
}
]
}StockType is not 1 (no stock tracking) (2410).Authorizations
Access token obtained from the Noyax auth service with your API key.
Headers
ID of the Noyax user the request is made on behalf of. Written to the audit fields of created, updated and deleted records.
x >= 1ID of the company. The user must be assigned to this company. All reads and writes are limited to this company.
x >= 1ID of the accounting period. Optional for customer endpoints; if sent, it is written to created records.
x >= 1Path Parameters
Product ID.
Critical stock definition ID.
Body
Required. ID of a warehouse from GET /api/v1/stock/warehouses.
Minimum stock level. Cannot be negative.
10
Maximum stock level. Cannot be negative; 0 means no maximum. When greater than 0, it cannot be less than MinStock.
500
What happens when MaxStock is exceeded. 0: Continue, 1: Warn the user, 2: Stop the operation.
1
What happens when stock falls below MinStock. 0: Continue, 1: Warn the user, 2: Stop the operation.
1
What happens when stock would go negative. 0: Continue, 1: Warn the user, 2: Stop the operation.
2
Response
OK
Whether the operation succeeded.
true
"0000" on success. On failure, the code of the first error; all errors are listed in Errors.
"0000"
Show child attributes
Show child attributes
Error message when Success is false. Messages of all errors are joined into a single text.