You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2019-05-29 08:14:13

saldig
Member
Registered: 2019-05-29
Posts: 1

API Rest ticket_user doesn't apply rules on target glpi system

Hello,
we are using GLPI API Rest to propagate a ticket from a source GLPI installation to a target GLPI installation.
In the source GLPI, if we have a ticket with an assigned user, when we propagate the same ticket in the target GLPI through the GLPI API Rest, a business rule configured on the target GLPI on the user assigned to the ticket is not executed (the rule has to assign the ticket to a configured group of users).
Here is the java function source code used to assign user to the ticket via Rest API.

public String assignUserToTicket(String ticketID, String userID, String tipo, String sessionToken) throws Exception, IOException {
        String retval = "";
        try {        
            SDIEUtentePerTicket assigner = new SDIEUtentePerTicket();
            assigner.setTickets_id(ticketID);
            assigner.setUsers_id(userID);
            assigner.setType(tipo); 
            assigner.setUse_notification("1");
            String url = super.getSistemaTarget().URL_Servizi_REST + "Ticket/" + ticketID + "/Ticket_User/";
            logger.debug(LOG_CAPTION + ": START assignUserToTicket from " + super.getSistemaTarget().URL_Servizi_REST + " - url: " + url +
                    " - assigner.getUsers_id(): " + assigner.getUsers_id());
            HttpResponse con = this.getConnection(assigner.inputJsonize(), "POST", url, sessionToken, super.getSistemaTarget().API_Token);              
            if (con == null || !con.isValid() || con.getResponse() == null || con.getResponse().equals("")){               
                retval = LOG_CAPTION + ": assignUserToTicket from " + super.getSistemaTarget().URL_Servizi_REST +
                        " with response code: nessuna risposta dal sistema GLPI(url: " + url +
                            " - assigner.getUsers_id(): " + assigner.getUsers_id();
                logger.error(retval);
            }           
        }
        catch (Exception e) {
            retval = LOG_CAPTION + ": assignUserToTicket from " + super.getSistemaTarget().URL_Servizi_REST + " with response code: "  + e.getMessage();
            logger.error(retval);
        }   
        logger.debug(LOG_CAPTION + ": END assignUserToTicket from " + super.getSistemaTarget().URL_Servizi_REST);
        return retval;
    }

The assigned user exists with the same login in the source and in the target system, so we are able to manage correcty the user id on both the GLPI installation.
The InitSession is performed through Application Token (Basic Authentication).

Can we help us to resolve this problem?
Thanks in advance

Offline

Board footer

Powered by FluxBB