Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Orion/Server API/User API"
< Orion | Server API
(→Listing users) |
|||
Line 125: | Line 125: | ||
| explain = The user must be authenticated as an admin user to access this API. The users_length specifies the number of users in the server workspace. If there is no start parameter the entire list is returned. If there is no end parameter the default is to return 20 rows. | | explain = The user must be authenticated as an admin user to access this API. The users_length specifies the number of users in the server workspace. If there is no start parameter the entire list is returned. If there is no end parameter the default is to return 20 rows. | ||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Orion/API|User]] | [[Category:Orion/API|User]] | ||
[[Category:Orion/Server API|User]] | [[Category:Orion/Server API|User]] |
Revision as of 19:58, 19 November 2014
The User API is a web server API for browsing and manipulating users.
Contents
Actions on users
Create a user
- Overview
- To create a new user account, send a POST request with the UserName and Password.
- HTTP Method
- POST
- Example Request
POST /users HTTP/1.1
Orion-Version: 1.0
Content-Type: application/json
{
"UserName" : "newuser",
"Password" : "newPassw0rd"
"FullName": "New User",
}
- Example Response
HTTP/1.1 201 CREATED
Content-Type: application/json
{
"EmailConfirmed": false,
"FullName": "New User",
"HasPassword": true,
"Location": "/users/newuser",
"UserName": "newuser"
}
- Detailed Explanation
- FullName and Email are optional fields that can be added to the request. The request does not need to be authenticated unless the server specifies the orion.auth.user.creation preference to allow only the admin user to create accounts.
Read a user
- Overview
- To read a user account profile, send a GET request.
- HTTP Method
- GET
- Example Request
GET /users/newuser HTTP/1.1
Orion-Version: 1.0
- Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"EmailConfirmed": false,
"FullName": "New User",
"HasPassword": true,
"Location": "/users/newuser",
"UserName": "newuser"
}
- Detailed Explanation
- The request needs to be authenticated as newuser or an admin user.
Update a user
- Overview
- To update a user account, send a PUT request with the updated properties.
- HTTP Method
- PUT
- Example Request
PUT /users/newuser HTTP/1.1
Orion-Version: 1.0
Content-Type: application/json
{
"Password" : "oldPassw0rd"
"NewPassword" : "newPassw0rd"
"FullName": "New Full Name",
}
- Example Response
HTTP/1.1 200 OK
- Detailed Explanation
- Users other than admin have to provide the old password to set a new one.
Delete a user
- Overview
- To delete a user account profile, send a DELETE request.
- HTTP Method
- DELETE
- Example Request
DELETE /users/newuser HTTP/1.1
Orion-Version: 1.0
- Example Response
HTTP/1.1 200 OK
- Detailed Explanation
- The request needs to be authenticated as newuser or an admin user.
Read the user list
- Overview
- An admin user can use the users API to get a user account list by sending a GET request.
- HTTP Method
- GET
- Example Request
GET /users?start=0&rows=3 HTTP/1.1
Orion-Version: 1.0
- Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{ "users": [
{
"DiskUsage": "16K",
"DiskUsageTimestamp": "1416434105405",
"Email": "user@somewhere.com",
"EmailConfirmed": true,
"FullName": "User Account",
"HasPassword": true,
"LastLoginTimestamp": "1416414407369",
"Location": "/users/account",
"UserName": "account"
},
{
"DiskUsage": "32K",
"DiskUsageTimestamp": "1416434105487",
"EmailConfirmed": false,
"FullName": "Administrative User",
"HasPassword": true,
"LastLoginTimestamp": "1416435479931",
"Location": "/users/admin",
"UserName": "admin"
},
{
"DiskUsage": "56K",
"DiskUsageTimestamp": "1416434105438",
"FullName": "Another User",
"HasPassword": true,
"LastLoginTimestamp": "1416434593638",
"Location": "/users/anotheruser",
"UserName": "anotheruser"
}
],
{
"users_length": 1956,
"users_rows": 3,
"users_start": 0
}
- Detailed Explanation
- The user must be authenticated as an admin user to access this API. The users_length specifies the number of users in the server workspace. If there is no start parameter the entire list is returned. If there is no end parameter the default is to return 20 rows.