A user is a person who is authorized to use the API.
id
- Unique and stable global identifier of a user- mandatory
- non editable, auto-assigned
- type: number
- example:
1
name
- Unique and short name that defines a user- mandatory
- non editable
- type: text
- example:
"user1"
List all existing users, in the order that they were created.
GET /api/users
Name | Type | In | Description |
---|---|---|---|
accept | string | header | Should be set to either application/json or application/vnd.siren+json |
page | integer | query | Specifies the current page of the list |
limit | integer | query | Specifies the number of results per page (max. 100) |
Status: 200 OK
{
"class": ["user", "collection"],
"properties": {
"collectionSize": 2,
"pageIndex": 0,
"pageSize": 2
},
"entities": [
{
"class": ["user"],
"rel": ["item"],
"properties": {
"id": 1,
"name": "user1"
},
"links": [
{
"rel": ["self"],
"href": "/api/users/1"
},
{
"rel": ["users"],
"href": "/api/users"
}
]
},
{
"class": ["user"],
"rel": ["item"],
"properties": {
"id": 2,
"name": "user2"
},
"links": [
{
"rel": ["self"],
"href": "/api/users/2"
},
{
"rel": ["users"],
"href": "/api/users"
}
]
}
],
"links": [
{
"rel": ["self"],
"href": "/api/users?page=0&limit=10"
},
{
"rel": ["page"],
"hrefTemplate": "/api/users{?page,limit}"
}
]
}
Status: 400 Bad Request
Status: 401 Unauthorized
Get a single user.
GET /api/users/{userId}
Name | Type | In | Description |
---|---|---|---|
accept | string | header | Should be set to either application/json or application/vnd.siren+json |
userId | integer | path | The user's unique identifier |
Status: 200 OK
{
"class": ["user"],
"properties": {
"id": 1,
"name": "user1"
},
"links": [
{
"rel": ["self"],
"href": "/api/users/1"
},
{
"rel": ["users"],
"href": "/api/users"
}
]
}
Status: 400 Bad Request
Status: 401 Unauthorized
Status: 404 Not Found
Get the currently authenticated user.
GET /api/user
Name | Type | In | Description |
---|---|---|---|
accept | string | header | Should be set to either application/json or application/vnd.siren+json |
Status: 200 OK
{
"class": ["user"],
"properties": {
"id": 1,
"name": "user1"
},
"links": [
{
"rel": ["self"],
"href": "/api/users/1"
},
{
"rel": ["users"],
"href": "/api/users"
}
]
}
Status: 401 Unauthorized