Function to update order. Only the sent fields are changed, the rest stays.
https://rest.crmango.com/api/UpdateOrder
Bearer
varchar
Auth token (required in Authorization header)
data
object
Object with the changed fields. Fields that are not sent stay unchanged
data.name
varchar
Order name
data.purchaser_fa_id
integer
Purchaser company id, 0 = none. Changing the company clears the purchaser person
Reference: GetAllContacts
data.purchaser_os_id
integer
Purchaser person id (must belong to the purchaser company), -1 = none
Reference: GetAllPersons
data.press_id
integer
Print set id
data.lang_id
varchar
Language (sk, cz, en)
data.notify
integer
Notification 0 - 3
data.text_after_header
varchar
Text after header
data.text_before_footer
varchar
Text before footer
data.taxable_date
date
Date of taxable (Y-m-d)
data.internal_number
varchar
Internal number
data.account_center
varchar
Account center
data.invoice_days
integer
Invoice due days
data.own_cols[0].id_own_col
integer
ID of custom field (own column)
data.own_cols[0].data
mixed
New value of the custom field. Only the changed columns can be sent
data.products_tables
array
Tables with items. WARNING: replaces ALL current items of the order including the transport price item. Send the complete list that should stay. Item format is the same as in CreateNewOrder (products_tables[0].products[0].*)
data.transport.vehicle_id
integer
Vehicle id
data.transport.trailer_id
integer
Trailer id
data.transport.driver_id
integer
Driver id
data.transport.driver2_id
integer
Second driver id
data.transport.points
array
Route points. If sent, they replace the current route. Format is the same as in CreateNewOrder (transport.points[0].*)
data.transport.price
float
Transport price. Added as a separate item only together with products_tables
Function to update order
code
integer
Return code
message
varchar
Info message
curl --request PUT \
--url 'https://rest.crmango.com/api/UpdateOrder' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
{
"order_id": 123,
"data": {
"name": "New order name",
"status_id": 5,
"user_id": 7,
"own_cols": [
{
"id_own_col": 2,
"data": 1
}
],
"products_tables": [
{
"table_name": "",
"products": [
{
"name": "Service",
"mj_id": 1,
"quantity": 2,
"price": 100,
"vat": 20,
"price_type_id": 0,
"discount": 0
}
]
}
],
"transport": {
"vehicle_id": 8,
"driver_id": 1,
"price": 235.24
}
}
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/UpdateOrder',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
{
"order_id": 123,
"data": {
"name": "New order name",
"status_id": 5,
"user_id": 7,
"own_cols": [
{
"id_own_col": 2,
"data": 1
}
],
"products_tables": [
{
"table_name": "",
"products": [
{
"name": "Service",
"mj_id": 1,
"quantity": 2,
"price": 100,
"vat": 20,
"price_type_id": 0,
"discount": 0
}
]
}
],
"transport": {
"vehicle_id": 8,
"driver_id": 1,
"price": 235.24
}
}
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
{
"order_id": 123,
"data": {
"name": "New order name",
"status_id": 5,
"user_id": 7,
"own_cols": [
{
"id_own_col": 2,
"data": 1
}
],
"products_tables": [
{
"table_name": "",
"products": [
{
"name": "Service",
"mj_id": 1,
"quantity": 2,
"price": 100,
"vat": 20,
"price_type_id": 0,
"discount": 0
}
]
}
],
"transport": {
"vehicle_id": 8,
"driver_id": 1,
"price": 235.24
}
}
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://rest.crmango.com/api/UpdateOrder");
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/UpdateOrder"
payload = json.dumps({
{
"order_id": 123,
"data": {
"name": "New order name",
"status_id": 5,
"user_id": 7,
"own_cols": [
{
"id_own_col": 2,
"data": 1
}
],
"products_tables": [
{
"table_name": "",
"products": [
{
"name": "Service",
"mj_id": 1,
"quantity": 2,
"price": 100,
"vat": 20,
"price_type_id": 0,
"discount": 0
}
]
}
],
"transport": {
"vehicle_id": 8,
"driver_id": 1,
"price": 235.24
}
}
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
{
"code": 200,
"message": "Order has been updated"
}
{
"code": "int",
"message": "string"
}