User Tools

Site Tools


api:rest

REST API

yourCMDB (since version 0.5 or higher) provides a REST API for accessing the data. You can access the data by using HTTP and the methods GET, DELTE, PUT and POST on the rest resources. The data that is used in GET responses and must be used in PUT and POST requests is represented in JSON.

accessing the API

The base for the API is rest.php which you can find in the <yourcmdb-root>/web directory. Authentication is done by HTTP Basic auth. You should use the credentials of a valid yourCMDB user, that has access rights for “rest”. Please see more details on authentication by having a look at the following Wiki page: authentication and authorisation

resources

In the following sections you can find an overview over the resources and methods that are available in the API.

objects

For accessing single objects. methods:

GET      /rest.php/objects/<assetId>
DELETE   /rest.php/objects/<assetId>
PUT      /rest.php/objects/<assetId>
POST     /rest.php/objects

objectlogs

For accessing the object log of a specific object. methods:

GET      /rest.php/objectlogs/<assetId>

For accessing all links to other objects. methods:

GET      /rest.php/objectlinks/<assetidA>
DELETE   /rest.php/objectlinks/<assetidA>/<assetidB>
POST     /rest.php/objectlinks/<assetidA>

objectlist

Getting a list of objects. methods:

GET     /rest.php/objectlist/by-fieldvalue/<value>
GET     /rest.php/objectlist/by-objecttype/<type>

objecttypes

Getting all configured object types and objecttype groups. methods:

GET     /rest.php/objecttypes/groups/
GET     /rest/objecttypes/groups/<groupname>

exporter (since version 0.11)

Getting a list of all configured exportAPI tasks methods:

GET     /rest.php/exporter/list/

Executing an export task. If the exporter writes something to STDOUT, the output will be returned.

PUT     /rest.php/exporter/export/<taskname>

labelprinter (since version 0.12)

Getting a list of all configured label printers which can be used for printing methods:

GET     /rest.php/labelprinter/list/print

Prints a label for the with assetId given object on the label printer with the name <printer name>.

PUT     /rest.php/labelprinter/print/<printer name>/<assetId>
api/rest.txt · Last modified: 2017/07/24 11:43 (external edit)