UpdateOrder

Function to update order. Only the sent fields are changed, the rest stays.

PUT https://rest.crmango.com/api/UpdateOrder

Authorization

1 Sent in the request headers
Bearer varchar

Auth token (required in Authorization header)

Body data

29 Sent in the request body
order_id integer

Id of the updated order
Reference: GetAllOrders

data object

Object with the changed fields. Fields that are not sent stay unchanged

data.name varchar

Order name

data.supplier_id integer

Supplier company id, 0 = none
Reference: GetAllContacts

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.user_id integer

Owner (user) id. The user must be visible to you
Reference: GetAllUsers

data.currency_id integer

Currency id. Existing items are not recalculated
Reference: GetAllLists

data.active_service_id integer

Active service id
Reference: GetAllLists

data.press_id integer

Print set id

data.lang_id varchar

Language (sk, cz, en)

data.notify integer

Notification 0 - 3

data.status_id integer

Order status (1, 5, 6, 7, 8, 9)
Reference: GetAllLists

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.transporter_id integer

Transporter company id
Reference: GetAllContacts

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

Response

2 HTTP 200

Function to update order

code integer

Return code

message varchar

Info message

Example request

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
        }
      }
    }
  }'
{
    "code": 200,
    "message": "Order has been updated"
}