Methods > glpi.getDocument

Version Comments
1.3.0 Allowed for not authenticated user

Retrieve a document if the authenticated user can view it.

This method can be called without authentication to retrieve document attached to public FAQ item (see glpi.getKnowBaseItem).
Of course, a not authenticated call could not retrieve a document which is not public.

input a hastable

  • help option to get usage information
  • document : ID of the document (mandatory)
  • ticket : ID of the ticket (if document is attached to a ticket)
  • id2name : option to enable id to name translation of dropdown fields
return a hashtable
  • fields of glpi_docs
  • base64 the content of the file, base64 encoded

Call example

$ php testxmlrpc.php --session=j4mp77bmqu428ff38gufl3fvi3  --method=glpi.getDocument --ticket=1 --document=18 --id2name
+ Calling 'glpi.getDocument' on http://localhost//glpi072/plugins/webservices/xmlrpc.php?session=j4mp77bmqu428ff38gufl3fvi3
+ Response: Array
(
    [id] => 18
    [entities_id] => 1
    [is_recursive] => 0
    [name] => firefox.png
    [filename] => PNG/firefox.png
    [filepath] => PNG/firefox.png
    [documentscategories_id] => 1
    [mime] => image/png
    [date_mod] => 2009-10-07 10:23:39
    [comment] => 
    [is_deleted] => 0
    [link] => 
    [notepad] => 
    [users_id] => 6
    [tickets_id] => 0
    [sha1sum] => 3a922e3fb18bed6da4cdc399f340c1f46c2f5452
    [base64] => iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QMGEhA2djby5gAA
...
/X+5Iebr/wDVf6UxTJ/4vAAAAABJRU5ErkJggg==
    [users_name] => REMI COLLET
    [documentscategories_name] => Pièces jointes ticket
)