GlpiaddTicketDocument » History » Version 11

yllen, 10/01/2015 02:35 PM

1 1 remi
h1. [[En_devguide#Provided-Methods|Methods]] > glpi.addTicketDocument
2 1 remi
3 6 walid
!https://forge.indepnet.net/svn/webservices/authenticated.png! +@This method is only accessible by authenticated users@+
4 6 walid
5 7 walid
| Version | Comments |
6 11 yllen
| 1.5.1 | name mandatory |
7 8 remi
| 1.2.0 | comment option is deprecated, use content instead |
8 7 walid
| 1.0.0 | base64 parameter added |
9 7 walid
| 0.3.0 | Method added |
10 7 walid
11 1 remi
Add a document to a existing ticket if the authenticated user can edit it.
12 1 remi
13 1 remi
*input* a hastable
14 1 remi
15 1 remi
* *help* option to get usage information
16 1 remi
17 2 remi
* *ticket* : ID of the ticket
18 11 yllen
* *name* : of the document to be updoaded
19 2 remi
* *uri* : of the document to be uploaded
20 1 remi
* *name* : of the document 
21 1 remi
* *base64* : content of the document base64 encoded string
22 8 remi
* *comment* : deprecated, use *content* instead
23 8 remi
* *content* : if present, also add a followup (if doc add succeed), for additional options see [[glpi.addTicketFollowup]]
24 1 remi
25 5 remi
base64 and uri cannot be set together. base64 also requires name (filename for extension check)
26 1 remi
27 1 remi
28 1 remi
*return* a  hastable if succed (as for [[glpi.getTicket]])
29 1 remi
30 8 remi
31 1 remi
Call example
32 1 remi
<pre>
33 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
34 8 remi
   --method=glpi.addTicketDocument \
35 8 remi
   --ticket=270 \
36 8 remi
   --base64=/bin/ls \
37 8 remi
   --name=ls
38 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
39 8 remi
xmlrpc error(15): Command failed (Unauthorized file type)
40 5 remi
41 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
42 8 remi
   --method=glpi.addTicketDocument \
43 8 remi
   --ticket=269 \
44 8 remi
   --base64=/usr/share/pixmaps/disks.png \
45 8 remi
   --name=disks.png
46 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
47 9 remi
xmlrpc error(15): Command failed (document already associated to this ticket)
48 5 remi
49 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
50 8 remi
   --method=glpi.addTicketDocument \
51 8 remi
   --ticket=269 --base64=/usr/share/pixmaps/redhat-home.png \
52 8 remi
   --name=redhat.png
53 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
54 5 remi
+ Response: Array
55 5 remi
(
56 8 remi
    [id] => 269
57 5 remi
    [entities_id] => 1
58 8 remi
...
59 8 remi
    [documents] => Array
60 5 remi
        (
61 5 remi
            [0] => Array
62 5 remi
                (
63 8 remi
                    [id] => 61
64 8 remi
                    [entities_id] => 1
65 8 remi
                    [is_recursive] => 0
66 8 remi
                    [name] => Document Ticket - coucou
67 8 remi
                    [filename] => redhat.png
68 8 remi
                    [filepath] => PNG/f7/2e51e8a0b3ac78d902ddc00122b64b7963302d.PNG
69 8 remi
                    [documentcategories_id] => 1
70 8 remi
                    [mime] => image/png
71 8 remi
                    [date_mod] => 2011-07-05 13:55:08
72 8 remi
                    [comment] => 
73 8 remi
                    [is_deleted] => 0
74 8 remi
                    [link] => 
75 8 remi
                    [notepad] => 
76 8 remi
                    [users_id] => 6
77 8 remi
                    [tickets_id] => 269
78 8 remi
                    [sha1sum] => f72e51e8a0b3ac78d902ddc00122b64b7963302d
79 1 remi
                )
80 1 remi
        )
81 8 remi
...
82 10 remi
    [events] => Array
83 10 remi
        (
84 10 remi
            [0] => Array
85 10 remi
                (
86 10 remi
                    [display_history] => 1
87 10 remi
                    [id] => 18089117
88 10 remi
                    [date_mod] => 05-07-2011 14:21
89 10 remi
                    [user_name] => REMI COLLET
90 10 remi
                    [field] => Documents
91 10 remi
                    [change] => add link with an item : "Document Ticket - coucou"
92 10 remi
                    [datatype] => 
93 10 remi
                )
94 10 remi
...
95 1 remi
</pre>