Methods > glpi.addTicketDocument¶
This method is only accessible by authenticated users
Version | Comments |
1.5.1 | name mandatory |
1.2.0 | comment option is deprecated, use content instead |
1.0.0 | base64 parameter added |
0.3.0 | Method added |
Add a document to a existing ticket if the authenticated user can edit it.
input a hastable
- help option to get usage information
- ticket : ID of the ticket
- name : of the document to be updoaded
- uri : of the document to be uploaded
- name : of the document
- base64 : content of the document base64 encoded string
- comment : deprecated, use content instead
- content : if present, also add a followup (if doc add succeed), for additional options see glpi.addTicketFollowup
base64 and uri cannot be set together. base64 also requires name (filename for extension check)
return a hastable if succed (as for glpi.getTicket)
Call example
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \ --method=glpi.addTicketDocument \ --ticket=270 \ --base64=/bin/ls \ --name=ls + Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2 xmlrpc error(15): Command failed (Unauthorized file type) $ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \ --method=glpi.addTicketDocument \ --ticket=269 \ --base64=/usr/share/pixmaps/disks.png \ --name=disks.png + Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2 xmlrpc error(15): Command failed (document already associated to this ticket) $ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \ --method=glpi.addTicketDocument \ --ticket=269 --base64=/usr/share/pixmaps/redhat-home.png \ --name=redhat.png + Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2 + Response: Array ( [id] => 269 [entities_id] => 1 ... [documents] => Array ( [0] => Array ( [id] => 61 [entities_id] => 1 [is_recursive] => 0 [name] => Document Ticket - coucou [filename] => redhat.png [filepath] => PNG/f7/2e51e8a0b3ac78d902ddc00122b64b7963302d.PNG [documentcategories_id] => 1 [mime] => image/png [date_mod] => 2011-07-05 13:55:08 [comment] => [is_deleted] => 0 [link] => [notepad] => [users_id] => 6 [tickets_id] => 269 [sha1sum] => f72e51e8a0b3ac78d902ddc00122b64b7963302d ) ) ... [events] => Array ( [0] => Array ( [display_history] => 1 [id] => 18089117 [date_mod] => 05-07-2011 14:21 [user_name] => REMI COLLET [field] => Documents [change] => add link with an item : "Document Ticket - coucou" [datatype] => ) ...