You are not logged in.
I'm trying to create a ticket where I need to assign it to the technician, using the REST API
I'm sending something similar to this:
fetch('https://serverglpi.local/apirest.php/ticket', {
method: 'POST',
headers: {
'Session-Token': result.authToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
})
const requestBody = {
input: {
name: title,
content: description,
date: currentdatetime,
entities_id: entity,
technicians_id: loggedInUsername
}
};
I tried passing the ID in technicians_id, but the ticket is opened but without the one assigned to it.
I validated the variable loggedInUsername is receiving 12 for example.
Last edited by roney-cs (2024-11-01 20:26:15)
Offline
Le champ « technicians_id » n'est pas valide pour les billets. Essayez plutôt « _users_id_assign ».
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Thank you for your interaction on this call.
Verion GLPI 9.3.3
I tested it by passing _users_id_assign and also users_id_assign
it had no effect.
const requestBody = {
input: {
name: title,
content: description,
date: currentdatetime,
entities_id: entity,
users_id_assign : loggedInUsername
}
};
fetch('https://glpiserver/apirest.php/ticket', {
method: 'POST',
headers: {
'Session-Token': result.authToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
})
The ticket was opened with all the information, but it was not assigned to user 12, for example
Last edited by roney-cs (2024-11-01 22:07:35)
Offline
Missing an underscore at the beginning. It is "_users_id_assign" not "users_id_assign". It isn't an actual property of the ticket, but instead just a sort of virtual one that tells the ticket code to create a link between the user and the ticket, so it has an underscore at the front.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline