Files
dolibarr/htdocs/api
MDW 7b54824d49 Fix #28071 - New branch to fix bad merge (#28083)
* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Qual: Introduce getDataToShowPhoto to prepare generic code

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix missing trans

* Fix langs

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Remove useless files in web templates

* Clean code

* Fix duplicate translation key

* Fix duplicate translation key

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix duplicate key

* Fix $object

* Debug v19

* WIP SMSing

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* WIP EMAILINGS_SUPPORT_ALSO_SMS

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* WIP SMSing

* Debug the "validate" feature

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Clean code

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Enhance rector to fix empty($user->rights->modulex->perm1)

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop

* Fix template to use v19 dev rules

* Fix use v19 dev rules

* Fix phpunit

* Debug v19

* Clean code

* Use rector to convert user->rights into user->hasRight

* Clean code

* Use rector to convert user->rights into user->hasRight

* Use rector to convert user->rights into user->hasRight

* Clean code

* Fix phpcs

* add editorconfig for sql files (#27999)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* add model_pdf field in llx_ticket-ticket.sql (#27996)

* add model_pdf field in llx_ticket-ticket.sql

* Update 19.0.0-20.0.0.sql

* Update 19.0.0-20.0.0.sql

* Improve wording in README (#27994)

* fix phpstan (#27989)

* fix phpstan

* Update UserRightsToFunction.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Qual: Fix spelling/working in datapolicy translations (#28006)

# Qual: Fix spelling/wording in datapolicy translations

Fixed some spelling and wording in datapolicy translations.

* qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986)

htdocs/ticket/class/ticketstats.class.php	98	Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth()

* Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop

* Fix user with readonly perm on email template must be able to read.

* Fix doc

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Better message

* Add missing fields in merge of thirdparty

* Debug v19 selection of ticket printer per terminal

* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

* Use constant

* NEW: Adding a recipient on emails sent, change status to sent partialy.

* fix travis (#28052)

* fix travis

* Update partnership.class.php

* fix php doc (#28047)

* fix undefined array key (#28048)

* Add region and departament for Cuba (#28046)

* Update llx_10_c_regions.sql

Add Cuba Regions (id_country=77)

* Update llx_20_c_departements.sql

Add Provinces Cuba (id country=77)

* Find the typo (#28050)

* Find the typo

* clean code

* add last_main_doc field to product (#28045)

* add las_main_doc field to product

* add field fetch

* NEW Add Categorie filter for ActionComm (#28041)

* New Add Categorie filter for ActionComm

New Add Categorie filter for ActionComm

* Fix space errors

Fix space errors

* Fix space errors 2

Fix space errors 2

* Update cunits.class.php (#28056)

FIX: error SQL when creating a Cunit

* Update codespell-lines-ignore.txt to avoid PR merge conflict

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: thibdrev <thibault.drevet@gmail.com>
Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com>
Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com>
Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com>
Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
2024-02-09 15:58:49 +01:00
..
2023-12-13 16:33:17 +01:00
2024-01-18 15:15:05 +01:00
2022-03-02 00:29:07 +01:00

API REST

Integrate your ERP with any other applications using Dolibarr APIs

This module provides the service to make Dolibarr a server of REST Web Services. It depends on external library Restler.

Extract any data or push insert, update or delete record using our new REST APIs. Using standard HTTP and Json format, it is compatible with any language (PHP, Java, Ruby, Python, C#, C++, JavaScript, JQuery, Basic, ...). Use the embedded APIs explorer tool to test APIs or get generated URLs to use in your own code.

Dolibarr API explorer

Explore the APIs

You can explore all available APIs by using the API explorer : yourdolibarr.tld/api/index.php/explorer (replace yourdolibarr.tld by real hostname of your Dolibarr installation)

Access to an API

Warning : access to any API should (or better : must!) be secured with SSL connection

To access to the API you need a token to identify. Only this token will allow to access API with. The token is dedicated to a user and it must be put into requests as DOLAPIKEY parameter in HTTP header (or among URL parameters, but this is less secured).

To get a token you can:

  • Edit the user card to set the value of token. Each user can have a different token.
  • or Call the login API with login and password. This will return the value of token for the user used to login.

Then call other services with

https://yourdolibarr.tld/mydolibarr/api/index.php/otherservice?DOLAPIKEY=api_key

Develop an API

The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples https://restler3.luracast.com/examples/index.html

Github contains also useful information : https://github.com/Luracast/Restler

To implement it into Dolibarr, you need to create a specific class for object we want to use. A skeleton file is available into /modulebuilder/class directory : api_mymodule_class.class.php The API class file must be put into object class directory, with specific file name. By example, API class file for 'myobject' must be put as : /htdocs/myobject/class/api_myobject.class.php. Class must be named MyobjectApi.

If a module provide several object, use a different name for 'myobject' and put the file into the same directory.

Define url for methods

It is possible to specify url for API methods by simply use the PHPDoc tag @url. See examples :

/**
* List contacts
* 
* Get a list of contacts
*
* @url	GET /contact/list
* @url	GET /contact/list/{socid}
* @url	GET	/thirdparty/{socid}/contacts
* [...]

Other Annotations Other annotations are used, you are encouraged to read them : https://github.com/Luracast/Restler/blob/master/ANNOTATIONS.md

PHPDoc tags can also be used to specify variables information for API. Again, rtfm : https://github.com/Luracast/Restler/blob/master/PARAM.md