Create price
curl --request POST \
--url https://api.noyax.com/api/v1/products/{productId}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-CompanyID: <x-companyid>' \
--header 'X-UserID: <x-userid>' \
--data '
{
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z"
}
'using RestSharp;
var options = new RestClientOptions("https://api.noyax.com/api/v1/products/{productId}/prices");
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 \"PriceType\": 2,\n \"Price\": 450,\n \"CurrencyCode\": \"TRY\",\n \"UnitCode\": \"C62\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {
'X-UserID': '<x-userid>',
'X-CompanyID': '<x-companyid>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
PriceType: 2,
Price: 450,
CurrencyCode: 'TRY',
UnitCode: 'C62',
StartDate: '2023-11-07T05:31:56Z',
EndDate: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.noyax.com/api/v1/products/{productId}/prices', 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}/prices"
payload = {
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z"
}
headers = {
"X-UserID": "<x-userid>",
"X-CompanyID": "<x-companyid>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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",
"CurrencyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"UnitId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerGroupDetailId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"UnitName": "<string>",
"CustomerName": "<string>",
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"IncludesVat": false,
"Discount": 10,
"IsDiscountPercentage": true,
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"CustomerCode": "<string>",
"CustomerGroup": "<string>",
"CustomerGroupDetail": "<string>",
"Description": "<string>"
},
"Message": "<string>"
}{
"Success": false,
"ResultCode": "2314",
"Message": "CustomerCode cannot be combined with CustomerGroup or CustomerGroupDetail.",
"Errors": [
{
"Code": "2314",
"Message": "CustomerCode cannot be combined with CustomerGroup or CustomerGroupDetail."
}
]
}{
"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": "0120",
"Message": "Daily request limit (10000) exceeded.",
"Errors": [
{
"Code": "0120",
"Message": "Daily request limit (10000) exceeded."
}
]
}Prices
Create product price
Adds a new price/discount row to the product.
POST
/
api
/
v1
/
products
/
{productId}
/
prices
Create price
curl --request POST \
--url https://api.noyax.com/api/v1/products/{productId}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-CompanyID: <x-companyid>' \
--header 'X-UserID: <x-userid>' \
--data '
{
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z"
}
'using RestSharp;
var options = new RestClientOptions("https://api.noyax.com/api/v1/products/{productId}/prices");
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 \"PriceType\": 2,\n \"Price\": 450,\n \"CurrencyCode\": \"TRY\",\n \"UnitCode\": \"C62\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {
'X-UserID': '<x-userid>',
'X-CompanyID': '<x-companyid>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
PriceType: 2,
Price: 450,
CurrencyCode: 'TRY',
UnitCode: 'C62',
StartDate: '2023-11-07T05:31:56Z',
EndDate: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.noyax.com/api/v1/products/{productId}/prices', 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}/prices"
payload = {
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z"
}
headers = {
"X-UserID": "<x-userid>",
"X-CompanyID": "<x-companyid>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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",
"CurrencyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"UnitId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"CustomerGroupDetailId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"UnitName": "<string>",
"CustomerName": "<string>",
"PriceType": 2,
"Price": 450,
"CurrencyCode": "TRY",
"IncludesVat": false,
"Discount": 10,
"IsDiscountPercentage": true,
"UnitCode": "C62",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"CustomerCode": "<string>",
"CustomerGroup": "<string>",
"CustomerGroupDetail": "<string>",
"Description": "<string>"
},
"Message": "<string>"
}{
"Success": false,
"ResultCode": "2314",
"Message": "CustomerCode cannot be combined with CustomerGroup or CustomerGroupDetail.",
"Errors": [
{
"Code": "2314",
"Message": "CustomerCode cannot be combined with CustomerGroup or CustomerGroupDetail."
}
]
}{
"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": "0120",
"Message": "Daily request limit (10000) exceeded.",
"Errors": [
{
"Code": "0120",
"Message": "Daily request limit (10000) exceeded."
}
]
}PriceType, Price, CurrencyCode, StartDate and EndDate are required.
PriceType | Meaning |
|---|---|
1 | Purchase |
2 | Sales |
Pricemust be greater than 0 (2302).Discountis a percentage or a fixed amount depending onIsDiscountPercentage(defaulttrue); it cannot be negative (2303), and as a percentage it cannot exceed 100 (2304).EndDatemust be afterStartDate(2306).UnitCodeis required and must be one of the product’s own units: its main unit (UnitCode) or, if the product has a second/third unit, one of those. Any other unit in the company, or a unit that does not belong to the product, is rejected (2309).IncludesVatsays whetherPriceincludes VAT.
Scope
A price row has at most one scope; if none are sent, it is a general price open to everyone.| Scope | How to send it |
|---|---|
| General | CustomerCode, CustomerGroup, CustomerGroupDetail all empty |
| A single customer | Only CustomerCode |
| An entire customer group | Only CustomerGroup (the name of a customer group) |
| One detail of a customer group | CustomerGroup and CustomerGroupDetail together; the detail must belong to that group |
CustomerCodecannot be combined with either group field (2314).CustomerGroupDetailcannot be sent withoutCustomerGroup(2313); selecting a detail alone is not meaningful, the group must be specified first.
Error codes
Codes this endpoint can return. The general errors that apply to every endpoint (authentication, permissions, request headers, request limits) are not repeated here.| Code | HTTP | Meaning |
|---|---|---|
0002 | 400 | Request body could not be read (malformed JSON, wrong field type), or it contains a field the endpoint does not have |
0580 | 400 | A value given as text (a code or a name) matches more than one record; add the detail that tells them apart (for example City for a district, Country for a city) |
2000 | 404 | Product not found |
2301 | 400 | PriceType must be 1 (purchase) or 2 (sales) |
2302 | 400 | Price must be greater than 0 |
2303 | 400 | Discount cannot be negative |
2304 | 400 | Discount cannot exceed 100 while IsDiscountPercentage is true |
2305 | 400 | StartDate and EndDate are required |
2306 | 400 | EndDate must be after StartDate |
2307 | 400 | CurrencyCode is required |
2308 | 400 | Currency not found in the company |
2309 | 400 | UnitCode is not one of the product’s own units (Unit1/Unit2/Unit3) |
2310 | 400 | Customer not found in the company |
2311 | 400 | Customer group not found in the company |
2312 | 400 | CustomerGroupDetail is not a detail of CustomerGroup |
2313 | 400 | CustomerGroupDetail cannot be sent without CustomerGroup |
2314 | 400 | CustomerCode cannot be combined with the group fields |
2315 | 400 | UnitCode is required |
Authorizations
Headers
Body
application/jsontext/jsonapplication/*+json
Response
Created