OBAPI OBAPI

Demonstration

Proof of concept

An OBAPI server built on Dolibarr ERP, queried by a simple PHP command-line client:

$ php obapi-client.php
Connecting to your OBAPI server:
  http://192.168.16.183/16/obapi/v1/invoices

Invoices listing:
+------+-------------+------------+----------------------------------------+-----------+-----------+--------+
| ID   | Ref         | Date       | Label                                  | Excl. tax | Incl. tax | Status |
+------+-------------+------------+----------------------------------------+-----------+-----------+--------+
| 54   | FA1912-0053 | 2019-12-12 |                                        |  1 527.00 |  1 832.40 | paid   |
| 57   | FA2001-0002 | 2020-01-22 |                                        |  1 527.00 |  1 832.40 | paid   |
| 60   | FA2001-0004 | 2020-01-31 |                                        | 12 500.00 | 15 000.00 | paid   |
| 62   | FA2002-0006 | 2020-02-21 |                                        |  1 527.00 |  1 832.40 | paid   |
| 67   | FA2003-0011 | 2020-03-19 |                                        |  1 527.00 |  1 832.40 | paid   |
| 70   | FA2004-0014 | 2020-04-18 |                                        |  1 527.00 |  1 832.40 | paid   |
| 850  | FA2209-0646 | 2022-09-09 |                                        |  1 527.00 |  1 832.40 | paid   |
| 1081 | FA2212-0842 | 2022-12-06 | Accompagnement technique Novembre 2022 |  1 527.00 |  1 832.40 | paid   |
+------+-------------+------------+----------------------------------------+-----------+-----------+--------+

Same client, different provider

The same client works against a completely different backend (not Dolibarr):

$ php obapi-client.php --server doliscan.devtemp.fr
Connecting to your OBAPI server:
  https://doliscan.devtemp.fr/obapi/v1/invoices

Invoices listing:
+----------+----------+------------+----------+-----------+-----------+--------+
| ID       | Ref      | Date       | Label    | Excl. tax | Incl. tax | Status |
+----------+----------+------------+----------+-----------+-----------+--------+
| 10215488 | 01025488 | 2022-11-05 | Nov.2022 |      9.99 |     11.99 | paid   |
| 10215496 | 01025496 | 2022-12-05 | Dec.2022 |      9.99 |     11.99 | paid   |
+----------+----------+------------+----------+-----------+-----------+--------+

Zero code change between the two providers. That's the point.

What the API returns

Behind the scenes, the client makes a simple HTTP call:

curl -H "Authorization: Bearer abc123" \
  https://provider.example.com/obapi/v1/invoices

And gets back standard JSON:

{
    "items": [
        {
            "id": "850",
            "ref": "FA2209-0646",
            "date_invoice": "2022-09-09",
            "status": "paid",
            "total_excl_tax": "1527.00",
            "total_vat": "305.40",
            "total_incl_tax": "1832.40"
        }
    ],
    "pagination": {
        "page": 1,
        "per_page": 50,
        "total_items": 8,
        "total_pages": 1
    }
}

Download a PDF

curl -H "Authorization: Bearer abc123" \
  -o FA2209-0646.pdf \
  "https://provider.example.com/obapi/v1/download/850?type=invoice"

The PDF lands on your disk. No portal, no login form, no CAPTCHA.

Beyond invoices

The same pattern works for all 24 OBAPI objects:

# List orders
curl -H "Authorization: Bearer abc123" \
  https://provider.example.com/obapi/v1/orders

# List products
curl -H "Authorization: Bearer abc123" \
  https://provider.example.com/obapi/v1/products

# List supplier invoices
curl -H "Authorization: Bearer abc123" \
  https://provider.example.com/obapi/v1/supplier-invoices

# Discover server capabilities
curl -H "Authorization: Bearer abc123" \
  https://provider.example.com/obapi/v1