Developer Guide¶
Minimal client test script for XMLRPC call¶
The folder scripts contains a simple client which can be used to test the server.
$ php testxmlrpc.php --help usage : testxmlrpc.php [ options] help : display this screen host : server name or IP, default : localhost url : XML-RPC plugin URL, default : /glpisvn/plugins/webservices/xmlrpc.php username : User name for security check (optionnal) password : User password (optionnal) session : identifier returned by [[glpi.doLogin]] method : XML-RPC method to call, default : glpi.test deflate : allow server to compress response (if supported) Other options are used for XML-RPC call.
Since 1.6.1, value of host, and url options are saved, so are preserved between calls. After a call to glpi.doLogin the returned session identifier is also saved, so the --session option is usually not needed.
Standard error codes¶
From Server- 1 : Access Denied (server configuration)
- 2 : Unknown method
- 3 : Unknown function (method defined but without internal function)
- 4 : Server not ready (plugin not installed or not activated)
- 10 : Not found
- 11 : Missing parameter (one of the mandatory parameter is not provided)
- 12 : Login failed (unknown user or bad password)
- 13 : Not authenticated (call of a secured method without doLogin)
- 14 : Bad parameter (bad value of a parameter)
- 15 : Command have failed (bad return from a GLPI function/method)
- 16 : Not allowed
Provided Methods¶
All methods expect a single parameter which is a hashtable.
get Methods¶
The glpi.*get*xxx method return a simple hastable if succeed or an "not found" error.
list Methods¶
The glpi.*list*xxx method return an array of hastable if succeed or an empty array.
When this is indicated, such method accept, as option
- count : only count item, return will a be a simple hashtable with a single entry 'count'
- start : result will start after # item (probably return in a previous call)
- limit : result will not contains more than # item
- order : sort option, a string (key name) or an hastable where each entry have the key name as index, and ASC or DESC as value. Allowed key names are listed on each method page. P.e. array('priority'=>DESC, 'date'=>ASC)
By default, start is 0 and limit is the GLPI configured value (list_limit_max)
Not authenticated method¶
- glpi.doLogin
- glpi.test
- glpi.status
- glpi.listAllMethods
- glpi.listEntities
- glpi.listKnowBaseItems
- glpi.getKnowBaseItem
- glpi.getDocument
Authenticated method¶
User context methods
Information retrieval methods
- glpi.listDropdownValues
- glpi.listGroups
- glpi.listHelpdeskItems
- glpi.listHelpdeskTypes
- glpi.listInventoryObjects
- glpi.listObjects
- glpi.listTickets
- glpi.listUsers
Actions methods
- glpi.createTicket
- glpi.addTicketDocument
- glpi.addTicketFollowup
- glpi.addTicketTask
- glpi.addTicketObserver
- glpi.setTicketSatisfaction
- glpi.setTicketValidation
- glpi.setTicketSolution
- glpi.setTicketAssign
Deprecated methods