Methods > glpi.createTicket

This method is only accessible by authenticated users

Version Comments
1.7.0 Add location, groupobserver and actiontime
1.3.2 Add impact and groupassign options - check if urgency and impact are allowed in matrix
1.3.0 Add victim options
1.2.0 Add type, source, requester and observer options
0.2.0 Method added

Create a new ticket

input hashtable

  • help option to get usage information
  • entity : ID, optional, default is current one, must be in the active ones
  • user : requester ID, optional, default to current logged user
  • group : requester ID, optional, default to none
  • requester : additional requester(s), integer Or array of integer (requires glpi >= 0.80.2 to work), with mail notification
  • victim : additional requester(s), integer Or array of integer, without mail notification
  • observer : additional observer(s), integer Or array of integer
  • groupassign : assign ID, optional, default to none
  • date : optional, default to system date ("YYYY-MM-DD HH:MM:SS")
  • itemtype : ID of the type of the item, optional, default none
  • item : ID of the item, optional, default none
  • title : short description (name) of the ticket, optional or mandatory (GLPI configuration)
  • content : log description, mandatory
  • urgency : default 3, from 1 to 5 (check if allowed in matrix)
  • impact : default 3, from 1 to 5 (check if allowed in matrix)
  • type : of ticket (default: 1)
  • source : name of the 'RequestType' (created if needed), optional, default WebServices
  • category : optional or mandatory (GLPI configuration), default none
  • user_email : optional, enable notification to this email address (must be valid)
  • use_email_notification : optional, enable notification to the user's email (if known)
  • groupobserver : ID, optional, default to none
  • location : ID, optional, default to none
  • actiontime : numeric value in seconds, optional, default to none

return a hastable if succeed (as for glpi.getTicket)

Call example

$ php testxmlrpc.php --method=glpi.doLogin \
   --login_password=secret --login_name=remi
+ Calling 'glpi.doLogin' on http://localhost//glpi072/plugins/webservices/xmlrpc.php
+ Response: Array
(
    [id] => 6
    [name] => remi
    [realname] => COLLET
    [firstname] => REMI
    [session] => hsoiuvb97thqhubhgikrjm8aq3
)

$ php testxmlrpc.php --session=e0797sn66djmq2vciqa7n7ls02  \
   --method=glpi.listDropdownValues \
   --dropdown=TicketType
+ Calling 'glpi.listDropdownValues' on http://localhost//glpi080/plugins/webservices/xmlrpc.php?session=e0797sn66djmq2vciqa7n7ls02
+ Response: Array
(
    [0] => Array
        (
            [id] => 1
            [name] => Incident
        )
    [1] => Array
        (
            [id] => 2
            [name] => Request
        )
)

$ php testxmlrpc.php --session=hsoiuvb97thqhubhgikrjm8aq3 \
   --method=glpi.listDropdownValues \
   --dropdown=TicketCategory --helpdesk
+ Calling 'glpi.listDropdownValues' on http://localhost//glpi072/plugins/webservices/xmlrpc.php?session=hsoiuvb97thqhubhgikrjm8aq3
+ Response: Array
(
    [0] => Array
        (
            [id] => 1
            [entities_id] => 0
            [is_recursive] => 1
            [ticketcategories_id] => 0
            [name] => Hardware
            [completename] => Hardware
            [comment] => 
            [level] => 1
            [knowbaseitemcategories_id] => 0
            [users_id] => 0
            [groups_id] => 0
            [ancestors_cache] => 
            [sons_cache] => {"1":"1"}
            [is_helpdeskvisible] => 1
        )
    [1] => Array
        (
            [id] => 1
            [entities_id] => 0
            [is_recursive] => 1
            [ticketcategories_id] => 0
            [name] => Software
            [completename] => Software
            [comment] => 
            [level] => 1
            [knowbaseitemcategories_id] => 0
            [users_id] => 0
            [groups_id] => 0
            [ancestors_cache] => 
            [sons_cache] => {"2":"2"}
            [is_helpdeskvisible] => 1
        )

)

$ php testxmlrpc.php --session=hsoiuvb97thqhubhgikrjm8aq3 \
   --method=glpi.createTicket \
   --type=1  --category=1 \
   "--title=Need help" "--content=I can't send a mail" 
+ Calling 'glpi.createTicket' on http://localhost//glpi072/plugins/webservices/xmlrpc.php?session=hsoiuvb97thqhubhgikrjm8aq3
+ Response: Array
(
    [id] => 287
    [entities_id] => 1
    [name] => Need help
    [date] => 2011-07-04 14:21:37
    [closedate] => 
    [solvedate] => 
    [date_mod] => 2011-07-04 14:21:37
    [users_id_lastupdater] => 6
    [status] => new
    [users_id_recipient] => 6
    [requesttypes_id] => 6
    [suppliers_id_assign] => 0
    [itemtype] => 
    [items_id] => 0
    [content] => I can't send a mail
    [urgency] => 3
    [impact] => 3
    [priority] => 3
    [ticketcategories_id] => 2
    [type] => 1
    [cost_time] => 0.0000
    [cost_fixed] => 0.0000
    [cost_material] => 0.0000
    [ticketsolutiontypes_id] => 0
    [solution] => 
    [global_validation] => none
    [due_date] => 
    [begin_waiting_date] => 
    [sla_waiting_duration] => 0
    [ticket_waiting_duration] => 0
    [close_delay_stat] => 0
    [solve_delay_stat] => 0
    [takeintoaccount_delay_stat] => 0
    [actiontime] => 0
    [slas_id] => 0
    [slalevels_id] => 0
    [slalevels_next_id] => 0
    [slalevels_next_date] => 
    [users] => Array
        (
            [requester] => Array
                (
                    [0] => Array
                        (
                            [id] => 410
                            [users_id] => 6
                            [use_notification] => 1
                            [alternative_email] => 
                        )
                )
            [observer] => Array
                (
                )
            [assign] => Array
                (
                )
        )
    [groups] => Array
        (
            [requester] => Array
                (
                )
            [observer] => Array
                (
                )
            [assign] => Array
                (
                )
        )
    [followups] => Array
        (
        )
    [tasks] => Array
        (
        )
    [documents] => Array
        (
        )
    [events] => Array
        (
            [0] => Array
                (
                    [display_history] => 1
                    [id] => 18089070
                    [date_mod] => 04-07-2011 14:21
                    [user_name] => REMI COLLET
                    [field] => 
                    [change] => add the item
                    [datatype] => 
                )
            [1] => Array
                (
                    [display_history] => 1
                    [id] => 18089069
                    [date_mod] => 04-07-2011 14:21
                    [user_name] => REMI COLLET
                    [field] => User
                    [change] => add link with an item : "REMI COLLET" 
                    [datatype] => 
                )

        )
    [validations] => Array
        (
        )
    [satisfaction] => Array
        (
        )
)