Dolibarr 15.0.3 Create Invoice Rest API

Hello all. We want to create a Dolibarr invoice using createinvoice REST api. How do we find out exactly what parameters to send and what syntax to use?

Hein

Bumping this because the swagger docs aren’t clear, they just give an endpoint, POST to /invoices, and they say use this model:

createInvoicesModel {
    request_data (Array[string], optional):
    Request datas
}

And if I look up that model all I find is

"createInvoicesModel": {
      "properties": {
        "request_data": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Request datas"
        }
      }
    },

So I’m not clear on how to construct my request

Look at the related api_< modulname >.class.php for the definition of $FIELDS
In the case of invoices there is only one field “socid”.
So put this in the Swagger UI (POST /invoices)

{ "socid": "2597" }

2597 is the socid of the thirdparty

I believe it works the same with the other API commands.