You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
4.0 KiB
158 lines
4.0 KiB
User API
|
|
========
|
|
|
|
.. http:get:: /user/(str:user_name)
|
|
|
|
Find a user by name.
|
|
|
|
**Example request**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
GET /user/atheneum_administrator HTTP/1.1
|
|
Host: example.tld
|
|
Accept: application/json
|
|
Authorization: Token <Base64(user:userToken)>
|
|
|
|
**Example response**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
HTTP/1.1 200 OK
|
|
Vary: Accept
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"creationTime": "2018-07-29T11:58:17-05:00",
|
|
"lastLoginTime": "2018-07-29T12:43:27-05:00",
|
|
"name": "atheneum_administrator",
|
|
"role": "ADMIN",
|
|
"version": 0
|
|
}
|
|
|
|
:reqheader Accept: the response content type depends on :mailheader:`Accept` header
|
|
:reqheader Authorization: The encoded basic authorization
|
|
:resheader Content-Type: this depends on :mailheader:`Accept` header of request
|
|
:statuscode 200: successfully retrieved the user
|
|
:statuscode 401: authorization failed
|
|
:statuscode 404: user doesn't exist
|
|
|
|
.. http:patch:: /user/(str:user_name)
|
|
|
|
Patch a user.
|
|
|
|
**Example request**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
PATCH /user/atheneum_administrator HTTP/1.1
|
|
Host: example.tld
|
|
Accept: application/json
|
|
Authorization: Token <Base64(user:userToken)>
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"lastLoginTime": "2019-07-29T12:43:27-05:00",
|
|
"version": 0
|
|
}
|
|
|
|
**Example response**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
HTTP/1.1 200 OK
|
|
Vary: Accept
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"creationTime": "2018-07-29T11:58:17-05:00",
|
|
"lastLoginTime": "2019-07-29T12:43:27-05:00",
|
|
"name": "atheneum_administrator",
|
|
"role": "ADMIN",
|
|
"version": 1
|
|
}
|
|
|
|
:reqheader Accept: the response content type depends on :mailheader:`Accept` header
|
|
:reqheader Authorization: The encoded basic authorization
|
|
:reqheader Content-Type: application/json
|
|
:resheader Content-Type: this depends on :mailheader:`Accept` header of request
|
|
:statuscode 200: successfully patched the user
|
|
:statuscode 400: an issue in the payload was discovered
|
|
:statuscode 401: authorization failed
|
|
:statuscode 404: user doesn't exist
|
|
|
|
.. http:post:: /user/
|
|
|
|
Register a new user with the service.
|
|
|
|
**Example request**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
POST /user/ HTTP/1.1
|
|
Host: example.tld
|
|
Accept: application/json
|
|
Authorization: Token <Base64(user:userToken)>
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "test_user",
|
|
"password": "JvZ9bm79",
|
|
"role": "USER"
|
|
}
|
|
|
|
**Example response**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
HTTP/1.1 200 OK
|
|
Vary: Accept
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"creationTime": "2018-07-29T14:16:48-05:00",
|
|
"name": "test_user",
|
|
"role": "USER",
|
|
"version": 0
|
|
}
|
|
|
|
:reqheader Accept: the response content type depends on :mailheader:`Accept` header
|
|
:reqheader Authorization: The encoded basic authorization
|
|
:reqheader Content-Type: application/json
|
|
:resheader Content-Type: this depends on :mailheader:`Accept` header of request
|
|
:statuscode 200: successfully registered the user
|
|
:statuscode 400: an issue in the payload was discovered
|
|
:statuscode 401: authorization failed
|
|
|
|
.. http:delete:: /user/(str:user_name)
|
|
|
|
Register a new user with the service.
|
|
|
|
**Example request**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
DELETE /user/test_user HTTP/1.1
|
|
Host: example.tld
|
|
Accept: application/json
|
|
Authorization: Token <Base64(user:userToken)>
|
|
|
|
**Example response**:
|
|
|
|
.. sourcecode:: http
|
|
|
|
HTTP/1.1 200 OK
|
|
Vary: Accept
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"message": "Successfully Deleted",
|
|
"success": true
|
|
}
|
|
|
|
:reqheader Accept: the response content type depends on :mailheader:`Accept` header
|
|
:reqheader Authorization: The encoded basic authorization
|
|
:resheader Content-Type: this depends on :mailheader:`Accept` header of request
|
|
:statuscode 200: successfully deleted the user
|
|
:statuscode 401: authorization failed
|
|
:statuscode 404: user doesn't exist
|