6. API endpoints - User endpoint

Page / - last modified by Outhman Moustaghfir on 2022/06/13 13:17

User endpoint

last modified by Outhman Moustaghfir

on 2022/06/13 13:17

Table of Contents

Introduction

Endpoints

Introduction

We will go through all endpoints needed to manage the User entity.

Endpoints

URL [method]	Description	Input example	Output example
/rest/users [GET]	Get a list of all users of the current environment and its children,	(no input required)	{ "timestamp": 1637577153521, "status": "200", "data": [ { "userid": 1, "person": { "trkid": 1, "firstname": "admin", "lastname": "admin", "mailaddress": "omoustaghfir@ixpath.com", "phone": "0000000000", "role": null, "service": null }, "group": { "id": 1, "alias": "Root", "parent": 1, "permission": "562949953421311" }, "alias": "admin", "envId": 1, "password": "9f3824ae911a68ecdb3197534d26bcbf", "passworddelay": 9999, "language": "Fr", "lastconnected": 1637139174000, "lastpassword": 1542106801000, "active": true, "revokedelay": 99999, "defaultpage": 1, "firstaccess": false, "logged": "1637142774420", "timezone": "GMT+0", "envs": [ { "envid": 1, "parent": 1, "alias": "iXPath", "code": "", "sendurl": false, "active": true, "timezone": "Europe/Paris", "gitRepository": "" } ], "envsbloque": [] }, { "userid": 41, "person": { "trkid": 2, "firstname": "outhman", "lastname": "man", "mailaddress": "auth@abcd.com", "phone": "09374788998", "role": null, "service": null }, "group": { "id": 2, "alias": "User", "parent": { "id": 3, "alias": "Admin", "parent": 1, "permission": "562949953421311" }, "permission": "234333415669759" }, "alias": "user1", "envId": 25, "password": "3203019f997ea9edbfc25744e7f26bff", "passworddelay": 6738, "language": "Fr", "lastconnected": null, "lastpassword": null, "active": true, "revokedelay": 0, "defaultpage": 1, "firstaccess": false, "logged": null, "timezone": null, "envs": [ { "envid": 19, "parent": 1, "alias": "greatEnv", "code": "122", "sendurl": false, "active": true, "timezone": "GMT", "gitRepository": "" } ], "envsbloque": [ { "envid": 30, "parent": 29, "alias": "PARRR2", "code": "", "sendurl": false, "active": true, "timezone": "GMT", "gitRepository": "" } ] } ] }
/rest/users/{alias} [GET]	Get user by the alias	the {alias} must be replaced by the alias of the aimed user. eg : /rest/users/admin /rest/users/FirstUser	{ "timestamp": 1637577423572, "status": "200", "data": { "userid": 1, "person": { "trkid": 1, "firstname": "admin", "lastname": "admin", "mailaddress": "omoustaghfir@ixpath.com", "phone": "0000000000", "role": null, "service": null }, "group": { "id": 1, "alias": "Root", "parent": 1, "permission": "562949953421311" }, "alias": "admin", "envId": 1, "password": "9f3824ae911a68ecdb3197534d26bcbf", "passworddelay": 9999, "language": "Fr", "lastconnected": 1637139174000, "lastpassword": 1542106801000, "active": true, "revokedelay": 99999, "defaultpage": 1, "firstaccess": false, "logged": "1637142774420", "timezone": "GMT+0", "envs": [ { "envid": 1, "parent": 1, "alias": "iXPath", "code": "", "sendurl": false, "active": true, "timezone": "Europe/Paris", "gitRepository": "" } ], "envsbloque": [] } }
/rest/users [POST]	Add new user to database.	{ "alias": "user1", "password": "abcdef", "active": "1", "language": "Fr", "passworddelay": "6738", "defaultpage": "1", "firstaccess": "2", "group": 2, "person": { "firstname": "outhman", "lastname": "man", "mailaddress": "auje@aizi.com", "phone": "09374788998" }, "envs": [ "iXPath" ], "envsbloque": [ "AnotherEnv" ] } NB: All fields are required to save the new user	if the user has been added successfully : { "timestamp": 1637577821566, "status": "200", "data": true } if not, the value returned will be a message of the triggered error.
/rest/users/{id} [POST]	Update a certain user by giving the id	the {id} must be replaced by the concerned userId, eg: /rest/users/1 a JSON form must be submitted to modify the existing user, eg: if we want to modify the "phone" the user that we added in the last example : { "alias": "user1", "password": "abcdef", "active": "1", "language": "Fr", "passworddelay": "6738", "defaultpage": "1", "firstaccess": "2", "group": 2, "person": { "firstname": "outhman", "lastname": "man", "mailaddress": "auje@aizi.com", "phone": "00212747889928" }, "envs": [ "iXPath" ], "envsbloque": [ "AnotherEnv" ] }	if the user has been updated successfully : { "timestamp": 1637577821566, "status": "200", "data": true } if not, the value returned will be a message of the triggered error.
/rest/users/{id} [DELETE]	Delete a certain user by ID	the {is} must be replaced by the user's ID.	if the user has been deleted successfully : { "timestamp": 1637577821566, "status": "200", "data": true } if not, the value returned will be a message of the triggered error.