Function to create a new product
https://rest.crmango.com/api/CreateNewProduct
Bearer
varchar
Auth token
product_name
varchar
Product name
cost_price
integer
Product cost price
product_code
varchar
Product code
measure_unit
integer
Measure unit id
cost_type
integer
Cost type id
currency
varchar
Currency
service
varchar
Service
product_code_is
varchar
Product code in information service
list_price
integer|float
List price
price_type
integer
Price type
vat_value
integer
VAT value
analytics
varchar
Accounting Analytics
ean
varchar
EAN
categories
array
Product categories
in_stock
integer
Count products in stock
in_stock_partner
integer
Count products in stock (partner)
min_price
integer|float
Minimum price
card_type
integer
Product card type
product_files
array
Files associated with this products
img_url
varchar
Product image (URL)
Function to create a new product
code
integer
Return code
message
varchar
Info message
created_id
integer
Id of the created resource
curl --request POST \
--url 'https://rest.crmango.com/api/CreateNewProduct' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
{
"product_name": "PC HP2",
"cost_price": 100,
"product_code": 1,
"measure_unit": 0,
"cost_type": 0,
"currency": 202,
"service": 8,
"product_code_is": "PC-1234",
"list_price": 400,
"price_type": 0,
"vat_value": 0,
"analytics": "Test Input",
"ean": "pc1234",
"categories": [
"Computers",
"HP"
],
"in_stock": 25,
"in_stock_partner": 30,
"min_price": 300,
"card_type": 0
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/CreateNewProduct',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
{
"product_name": "PC HP2",
"cost_price": 100,
"product_code": 1,
"measure_unit": 0,
"cost_type": 0,
"currency": 202,
"service": 8,
"product_code_is": "PC-1234",
"list_price": 400,
"price_type": 0,
"vat_value": 0,
"analytics": "Test Input",
"ean": "pc1234",
"categories": [
"Computers",
"HP"
],
"in_stock": 25,
"in_stock_partner": 30,
"min_price": 300,
"card_type": 0
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
{
"product_name": "PC HP2",
"cost_price": 100,
"product_code": 1,
"measure_unit": 0,
"cost_type": 0,
"currency": 202,
"service": 8,
"product_code_is": "PC-1234",
"list_price": 400,
"price_type": 0,
"vat_value": 0,
"analytics": "Test Input",
"ean": "pc1234",
"categories": [
"Computers",
"HP"
],
"in_stock": 25,
"in_stock_partner": 30,
"min_price": 300,
"card_type": 0
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://rest.crmango.com/api/CreateNewProduct");
xhr.setRequestHeader("Authorization", "Bearer auth_token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
import requests
import json
url = "https://rest.crmango.com/api/CreateNewProduct"
payload = json.dumps({
{
"product_name": "PC HP2",
"cost_price": 100,
"product_code": 1,
"measure_unit": 0,
"cost_type": 0,
"currency": 202,
"service": 8,
"product_code_is": "PC-1234",
"list_price": 400,
"price_type": 0,
"vat_value": 0,
"analytics": "Test Input",
"ean": "pc1234",
"categories": [
"Computers",
"HP"
],
"in_stock": 25,
"in_stock_partner": 30,
"min_price": 300,
"card_type": 0
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
{
"code": 201,
"message": "New product has been created",
"created_id": 21
}
{
"code": "int",
"message": "string"
}