GlpiaddTicketDocument » History » Version 8

remi, 07/05/2011 01:57 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 8 remi
| 1.2.0 | comment option is deprecated, use content instead |
7 7 walid
| 1.0.0 | base64 parameter added |
8 7 walid
| 0.3.0 | Method added |
9 7 walid
10 1 remi
Add a document to a existing ticket if the authenticated user can edit it.
11 1 remi
12 1 remi
*input* a hastable
13 1 remi
14 1 remi
* *help* option to get usage information
15 1 remi
16 2 remi
* *ticket* : ID of the ticket
17 2 remi
* *uri* : of the document to be uploaded
18 1 remi
* *name* : of the document 
19 1 remi
* *base64* : content of the document base64 encoded string
20 8 remi
* *comment* : deprecated, use *content* instead
21 8 remi
* *content* : if present, also add a followup (if doc add succeed), for additional options see [[glpi.addTicketFollowup]]
22 1 remi
23 5 remi
base64 and uri cannot be set together. base64 also requires name (filename for extension check)
24 1 remi
25 1 remi
26 1 remi
*return* a  hastable if succed (as for [[glpi.getTicket]])
27 1 remi
28 8 remi
29 1 remi
Call example
30 1 remi
<pre>
31 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
32 8 remi
   --method=glpi.addTicketDocument \
33 8 remi
   --ticket=270 \
34 8 remi
   --base64=/bin/ls \
35 8 remi
   --name=ls
36 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
37 8 remi
xmlrpc error(15): Command failed (Unauthorized file type)
38 5 remi
39 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
40 8 remi
   --method=glpi.addTicketDocument \
41 8 remi
   --ticket=269 \
42 8 remi
   --base64=/usr/share/pixmaps/disks.png \
43 8 remi
   --name=disks.png
44 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
45 8 remi
xmlrpc error(15): Command failed (already a document for this ticket)
46 5 remi
47 8 remi
$ php testxmlrpc.php --session=7d4hcvbohi2l1mur233b4ajll2 \
48 8 remi
   --method=glpi.addTicketDocument \
49 8 remi
   --ticket=269 --base64=/usr/share/pixmaps/redhat-home.png \
50 8 remi
   --name=redhat.png
51 8 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=7d4hcvbohi2l1mur233b4ajll2
52 5 remi
+ Response: Array
53 5 remi
(
54 8 remi
    [id] => 269
55 5 remi
    [entities_id] => 1
56 8 remi
...
57 8 remi
    [documents] => Array
58 5 remi
        (
59 5 remi
            [0] => Array
60 5 remi
                (
61 8 remi
                    [id] => 61
62 8 remi
                    [entities_id] => 1
63 8 remi
                    [is_recursive] => 0
64 8 remi
                    [name] => Document Ticket - coucou
65 8 remi
                    [filename] => redhat.png
66 8 remi
                    [filepath] => PNG/f7/2e51e8a0b3ac78d902ddc00122b64b7963302d.PNG
67 8 remi
                    [documentcategories_id] => 1
68 8 remi
                    [mime] => image/png
69 8 remi
                    [date_mod] => 2011-07-05 13:55:08
70 8 remi
                    [comment] => 
71 8 remi
                    [is_deleted] => 0
72 8 remi
                    [link] => 
73 8 remi
                    [notepad] => 
74 8 remi
                    [users_id] => 6
75 8 remi
                    [tickets_id] => 269
76 8 remi
                    [sha1sum] => f72e51e8a0b3ac78d902ddc00122b64b7963302d
77 1 remi
                )
78 1 remi
        )
79 8 remi
...
80 1 remi
</pre>