Skip to content

API Users

Brunovski edited this page Sep 15, 2020 · 23 revisions

GET /users

Description: Retrieves the specified page of users

Request:

  • Query String:
    • page (Integer, Optional) Page to retrieve. Default value is 0
  • Example:
curl --location --request GET 'http://localhost:8080/users?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: A list of objects with the resumed information of the users
  • Content Type:
    • application/json
  • Schema:
[
   {
      "email": String
      "provider": String
      "version": Integer
   },
   ...
]
  • Example:
[{"email": "[email protected]", "provider": "google", "version": 1}, {"email": "[email protected]", "provider": "google", "version": 2}]

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: User

GET /users/{user}

Description: Retrieves the specified user

Request:

  • URI Params:
    • user (String) User email
  • Query String:
    • provider (String) Provider which the user registered with
    • version (Integer, Optional) Version of the user information. Default value is the current version
  • Example:
curl --location --request GET 'http://localhost:8080/users/[email protected]?provider=google'
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 200 OK
  • Content: An object with the information of the user
  • Content Type:
    • application/json
  • Schema:
{
   "email": String
   "provider": String
   "version": Integer
   "deprecated": Boolean
   "role": String
}
  • Example:
{
   "email": "[email protected]", 
   "provider": "google", 
   "version": 1,
   "deprecated": false,
   "role": "user"
}

Error Responses:

  • 404 Not Found
  • 401 Unauthorized

Role: User

PUT /users/{user}

Description: Updates the specified user. The user is updated only if it already exists.

Request:

  • URI Params:
    • user (String) User email
  • Query String:
    • provider (String) Provider which the user registered with
  • Content: An object with the information of the user
  • Content Type:
    • application/json
  • Schema:
{
   "email": String, 
   "provider": String, 
   "role": String - "admin" or "user"
}
  • Example:
curl --location --request PUT 'http://localhost:8080/users/[email protected]?provider=google'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {Access Token} '
--data-raw '{
   "email": "[email protected]", 
   "provider": "google", 
   "role": "admin"
}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 400 Bad Request
  • 401 Unauthorized

Role: Admin

DELETE /users/{user}

Description: Deprecates the specified user

Request:

  • URI Params:
    • user (String) User email
  • Query String:
    • provider (String) Provider which the user registered with
  • Example:
curl --location --request DELETE 'http://localhost:8080/users/[email protected]?provider=google
--header 'Authorization: Bearer {Access Token}'

Success Response:

  • Status Code: 204 No Content

Error Responses:

  • 401 Unauthorized

Role: Admin