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 2018-05-30 12:03:23

abel.aguzmans
Member
Registered: 2012-09-25
Posts: 20

GLPI API get users's e-mails and groups.

Hi everyone,

I am using the Rest API on version 9.1 and I need to get the Users's e-mails and groups. I can query for the user and get the user information, but those two things are not present:

curl -X GET -H 'Content-Type: application/json' -H "Session-Token: e7lbdXXXXXX5" -H "App-Token: XXXXXXKZbumsY85QL15" 'https://Myserver.com/apirest.php/User/2

Gives me the with ID 2 information, but in this information there is no group or e-mails:

{"id":2,"name":"glpi","phone":"","phone2":"","mobile":"","realname":"Abel","firstname":"Abel","locations_id":1,"language":null,"use_mode":0,"list_limit":null,"is_active":1,"comment":null,"auths_id":0,"authtype":1,"last_login":"2018-05-30 17:49:20","date_mod":"2018-03-12 14:44:47","date_sync":null,"is_deleted":0,"profiles_id":0,"entities_id":0,"usertitles_id":0,"usercategories_id":0,"date_format":null,"number_format":null,"names_format":null,"csv_delimiter":null,"is_ids_visible":null,"use_flat_dropdowntree":null,"show_jobs_at_login":null,"priority_1":null,"priority_2":null,"priority_3":null,"priority_4":null,"priority_5":null,"priority_6":null,"followup_private":null,"task_private":null,"default_requesttypes_id":null,"password_forget_token":"","password_forget_token_date":null,"user_dn":null,"registration_number":null,"show_count_on_tabs":null,"refresh_ticket_list":null,"set_default_tech":null,"personal_token":"XXXXXXXXXX","personal_token_date":"2018-03-09 11:03:54","api_token":"YYYYYYYYY","api_token_date":"2018-03-09 11:03:54","display_count_on_home":null,"notification_to_myself":null,"duedateok_color":null,"duedatewarning_color":null,"duedatecritical_color":null,"duedatewarning_less":null,"duedatecritical_less":null,"duedatewarning_unit":null,"duedatecritical_unit":null,"display_options":null,"is_deleted_ldap":0,"pdffont":null,"picture":null,"begin_date":null,"end_date":null,"keep_devices_when_purging_item":null,"privatebookmarkorder":"[]","backcreated":null,"task_state":null,"layout":null,"palette":null,"ticket_timeline":null,"ticket_timeline_keep_replaced_tabs":null,"set_default_requester":null,"lock_autolock_mode":null,"lock_directunlock_notification":null,"date_creation":null,"highcontrast_css":null,"plannings":"","sync_field":null,"links":[{"rel":"Location","href":"http://Myserver.com/apirest.php/Location/1"},{"rel":"Entity","href":"http://Myserver.com/apirest.php/Entity/0"},{"rel":"Document_Item","href":"http://Myserver.com/apirest.php/User/2/Document_Iteme

Can someone help me with this or to get at least some of the information or tell me if not possible?
I have been looking and testing many things with no good results.

Regards
Abel

Offline

#2 2018-05-30 14:32:57

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,167

Re: GLPI API get users's e-mails and groups.

to get user's groups use this url :

'https://Myserver.com/apirest.php/User/[$userId]/Group_User;


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

#3 2018-05-30 14:35:34

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,167

Re: GLPI API get users's e-mails and groups.

to get user's e-mail user thi url :
'https://Myserver.com/apirest.php/User/ [$userId] /Useremail


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

#4 2018-05-31 13:07:56

abel.aguzmans
Member
Registered: 2012-09-25
Posts: 20

Re: GLPI API get users's e-mails and groups.

Thanks it works.

Regards
Abel

Offline

Board footer

Powered by FluxBB