Any default APIs in Dolibarr for creating sales order records?

905 Views Asked by At

Dolibarr has a module for restful APIs.

The API explorer seems to show all the CRUD tasks for each module like orders, stock and customer.

api explorer

But to CREATE a record, the sample VALUE for the POST method shows as:

{ "request_data": [ "string" ] }

What are the specific field attributes that should go in here? Where can I look up the field requirements?

2

There are 2 best solutions below

0
On

When you need a parameter like { "request_data": [ "string" ] } for a POST API, all you have to do is to call the similar API to get a record (so the same API with the GET method). The result can be cut and paste to be used to create a new record (just change the id and ref in the answer retreived by the GET).

0
On

You should take a look at the attributes of the Commande class: https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/commande/class/commande.class.php

The object should be something like this :

{
  "date_commande" : "0000-00-00 00:00:00",
  "date_livraison" : "0000-00-00 00:00:00",
  "attribute3": "and so on"
}