GlpiaddTicketDocument » History » Version 6

walid, 05/04/2010 12:37 AM

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 1 remi
Add a document to a existing ticket if the authenticated user can edit it.
6 1 remi
7 1 remi
*input* a hastable
8 1 remi
9 1 remi
* *help* option to get usage information
10 1 remi
11 4 remi
* *ticket* : ID of the ticket
12 2 remi
* *uri* : of the document to be uploaded
13 2 remi
* *name* : of the document 
14 2 remi
* *comment* : of the document
15 5 remi
* *base64* : content of the document base64 encoded string (version 0.4.0)
16 1 remi
17 5 remi
base64 and uri cannot be set together. base64 also requires name (filename for extension check)
18 5 remi
19 5 remi
20 1 remi
*return* a  hastable if succed (as for [[glpi.getTicket]])
21 1 remi
* fields of *glpi_tracking* 
22 1 remi
* *followups* an array of hasble : fields of *glpi_followups*
23 1 remi
24 1 remi
Call example
25 1 remi
<pre>
26 3 remi
$ php testxmlrpc.php --session=j4mp77bmqu428ff38gufl3fvi3 --method=glpi.addTicketDocument \
27 3 remi
   --ticket=16 --uri=http://download.foo.com/screenshoot.jpg 
28 2 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi072/plugins/webservices/xmlrpc.php?session=j4mp77bmqu428ff38gufl3fvi3
29 1 remi
+ Response: Array
30 1 remi
(
31 1 remi
    [id] => 16
32 1 remi
    [entities_id] => 1
33 1 remi
    [name] => Need help
34 1 remi
    [date] => 2009-08-25 10:30:50
35 1 remi
    [closedate] => 
36 1 remi
    [date_mod] => 2009-08-25 10:35:21
37 1 remi
    [status] => new
38 1 remi
    [users_id] => 6
39 1 remi
    [users_id_recipient] => 6
40 1 remi
    [groups_id] => 0
41 1 remi
    [users_id_assign] => 0
42 1 remi
    [suppliers_id_assign] => 0
43 1 remi
    [groups_id_assign] => 0
44 1 remi
    [itemtype] => 0
45 1 remi
    [items_id] => 0
46 1 remi
    [content] => I can't send a mail
47 1 remi
    [urgence] => 3
48 1 remi
    [impact] => 3
49 1 remi
    [priority] => 3
50 1 remi
    [user_email] => 
51 1 remi
    [use_email_notification] => 0
52 1 remi
    [realtime] => 16
53 1 remi
    [ticketscategories_id] => 1
54 1 remi
    [cost_time] => 0.0000
55 1 remi
    [cost_fixed] => 0.0000
56 1 remi
    [cost_material] => 0.0000
57 1 remi
    [followups] => Array
58 1 remi
        (
59 1 remi
            [0] => Array
60 2 remi
                (
61 2 remi
                    [id] => 37
62 2 remi
                    [date] => 2009-08-25 14:15:05
63 2 remi
                    [users_id] => 6
64 2 remi
                    [content] => New document : Document ticket 16
65 2 remi
                )
66 2 remi
67 2 remi
68 2 remi
            [1] => Array
69 1 remi
                (
70 1 remi
                    [id] => 31
71 1 remi
                    [date] => 2009-08-25 10:35:21
72 1 remi
                    [users_id] => 6
73 1 remi
                    [content] => a new message
74 5 remi
                )
75 5 remi
        )
76 5 remi
)
77 5 remi
78 5 remi
$ php testxmlrpc.php --session=5hkf27tuddubh23hddekdl9pd7 --method=glpi.addTicketDocument \
79 5 remi
   --ticket=15 --name=cloud.png \
80 5 remi
   --base64=/usr/share/pixmaps/backgrounds/cosmos/cloud.jpg
81 5 remi
+ Calling 'glpi.addTicketDocument' on http://localhost//glpi072/plugins/webservices/xmlrpc.php?session=5hkf27tuddubh23hddekdl9pd7
82 5 remi
+ Response: Array
83 5 remi
(
84 5 remi
    [id] => 15
85 5 remi
    [entities_id] => 1
86 5 remi
    [name] => Cannot authenticated
87 5 remi
    [date] => 2009-06-01 10:04:00
88 5 remi
    [closedate] => 
89 5 remi
    [date_mod] => 2009-09-13 09:14:45
90 5 remi
    [status] => plan
91 5 remi
    [users_id] => 2
92 5 remi
    [users_id_recipient] => 2
93 5 remi
    [groups_id] => 1
94 5 remi
    [users_id_assign] => 0
95 5 remi
    [suppliers_id_assign] => 0
96 5 remi
    [groups_id_assign] => 0
97 5 remi
    [itemtype] => 1
98 5 remi
    [items_id] => 1
99 5 remi
    [content] => Cannot authenticated on GLPI
100 5 remi
See attached screenshoot.
101 5 remi
    [urgence] => 3
102 5 remi
    [impact] => 3
103 5 remi
    [priority] => 3
104 5 remi
    [user_email] => 
105 5 remi
    [use_email_notification] => 0
106 5 remi
    [realtime] => 15
107 5 remi
    [ticketscategories_id] => 1
108 5 remi
    [cost_time] => 0.0000
109 5 remi
    [cost_fixed] => 0.0000
110 5 remi
    [cost_material] => 0.0000
111 5 remi
    [followups] => Array
112 5 remi
        (
113 5 remi
            [0] => Array
114 5 remi
                (
115 5 remi
                    [id] => 27
116 5 remi
                    [date] => 2009-09-13 09:14:45
117 5 remi
                    [users_id] => 2
118 5 remi
                    [content] => New document : cloud.png
119 1 remi
                )
120 1 remi
        )
121 1 remi
)
122 1 remi
</pre>