You are not logged in.
Pages: 1
Topic closed
When we use RestAPI to create a ticket, its Requester is set as the owner of apiToken by default.
We wanted to set it to a work ID, but we didn't find out how to do so with API.
How to use RestAPI to specify the ticket's requester?
(Sorry for my English)
Last edited by KongNan (2021-04-06 08:48:13)
Offline
Hi, when you create your ticket add these paraméters in your JSON
{
'name': 'title',
'content': 'content',
'_users_id_assign': 2,
'_users_id_requester': 2,
'_groups_id_assign': 1,
...
}
edit : moved to API section
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
I agree with LaDenrée.
The leading "_" is tricky, I have to say :-)
Offline
Thank you, it works!
Can I set the status to "new" instead of "Processing (assigned)"? I tried to set '_users_id_assign' to 0 or "" , but it still assigned
Offline
We'll try the following, hope it helps
https://forum.glpi-project.org/viewtopic.php?id=160884
https://forum.glpi-project.org/viewtopic.php?id=161181
Offline
We'll try the following, hope it helps
https://forum.glpi-project.org/viewtopic.php?id=160884
https://forum.glpi-project.org/viewtopic.php?id=161181
Yes, it helps:
My Settings (preference) -> Personalization -> Assistance->
Pre-select me as Technician when Creating Ticket : NO
Pre-select me as Requester when Creating Ticket: NO
Offline
{
'_users_id_requester': 2,
}
Thank you for your reply!
I have another question, this _users_id_requester uses the internal ID, but I want to use the "Login" field of the user: ( for example 333 , auto-collected from windows %username% ).
How to do that? ( how to get user_id 2 with Login 333 )?
Sorry for my poor English
Offline
first get GLPI's user id :
$url=$api_url . "/search/User?forcedisplay[0]=2&forcedisplay[1]=1&criteria[1][field]=1&criteria[1][searchtype]=contains&criteria[1][value]=" . $login;
in your case $login would be ^333$ that means is exactly 333 otherwise 1333,2333,3333,4333, 3331 would match
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
Thank you! let's try that
Offline
Done! now we can use that to create correct tickets. Thank you!
Offline
Pages: 1
Topic closed