Public
Documentation Settings

Random League

Mock League where users, teams and fixtures can be created. All endpoints except the health and search endpoints are authenticated.

Environment is random-league prod

All authenticated routes require a Bearer token passed as a value to the Authorization header

Users

APIs that involve the CRUD features for users.

AUTHORIZATIONBearer Token
Token

<token>

POSTCreate a User

https://random-mock-league.herokuapp.com/v1/users

The form type for this request is multipart/form-data since image upload is possible on this request.

The role field is optional. The default role when no role is specified on user creation is user.

The avatar field is also optional. A default image is attached to the user's profile if no image is specified

AUTHORIZATIONBearer Token
This request is using Bearer Token from folderUsers
Bodyformdata
avatar
first_name

Margaret

last_name

Hamilton

password

password

email

maggie@test.dev

role

admin

Example Request
curl
curl --location 'https://random-mock-league.herokuapp.com/v1/users' \
--form 'avatar=@"/Users/adamsbanjo/Downloads/db248fdd04d02e221b1f72ea10c85ccba1797b18.png"' \
--form 'first_name="Margaret"' \
--form 'last_name="Hamilton"' \
--form 'password="password"' \
--form 'email="maggie@test.dev"' \
--form 'role="admin"'
200 OK
Example Response
json
{
  "status": "success",
  "message": "User created successfully",
  "data": {
    "user": {
      "avatar_url": "https://res.cloudinary.com/sajicode/image/upload/v1589420600/odqgi8fnuca9q008nn76.png",
      "role": "admin",
      "_id": "5ebca2392a8b25007fe18f3a",
      "first_name": "Margaret",
      "last_name": "Hamilton",
      "password": "$2a$10$iTL9qEp2uLkDBMYmW.NZ7.nTGj5mbpJbYaZ5VMb1HRnEDCv49Nl5a",
      "email": "maggie@test.dev",
      "created_at": "2020-05-14T01:43:21.365Z",
      "updated_at": "2020-05-14T01:43:21.365Z",
      "__v": 0
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImZpcnN0X25hbWUiOiJNYXJnYXJldCIsImxhc3RfbmFtZSI6IkhhbWlsdG9uIiwicm9sZSI6ImFkbWluIiwiX2lkIjoiNWViY2EyMzkyYThiMjUwMDdmZTE4ZjNhIn0sImlhdCI6MTU4OTQyMDYwMSwiZXhwIjoxNTkwMDI1NDAxLCJpc3MiOiJyYW5kb20tZ3V5cyJ9.tveAEUqllod2ce6sJeyLgu5XD8YW-fzdCzR5IdV-L5w"
  }
}
Server

Cowboy

Connection

keep-alive

X-Dns-Prefetch-Control

off

X-Frame-Options

SAMEORIGIN

Strict-Transport-Security

max-age=15552000; includeSubDomains

X-Download-Options

noopen

X-Content-Type-Options

nosniff

X-Xss-Protection

1; mode=block

Access-Control-Allow-Origin

*

Content-Type

application/json; charset=utf-8

Content-Length

764

Etag

W/"2fc-ybZEYMWX6eNL8A3Ptcq5UjVY4aM"

Vary

Accept-Encoding

Date

Thu, 14 May 2020 01:43:21 GMT

Via

1.1 vegur

GETGET all Users

https://random-mock-league.herokuapp.com/v1/users

Only an authenticated admin can get a list of all users

AUTHORIZATIONBearer Token
Token

<token>

Example Request
curl
curl --location 'https://random-mock-league.herokuapp.com/v1/users'
200 OK
Example Response
json
{
  "status": "success",
  "message": "Users returned successfully",
  "data": {
    "users": [
      {
        "avatar_url": "https://res.cloudinary.com/sajicode/image/upload/v1589420600/odqgi8fnuca9q008nn76.png",
        "role": "admin",
        "_id": "5ebca2392a8b25007fe18f3a",
        "first_name": "Margaret",
        "last_name": "Hamilton",
        "email": "maggie@test.dev",
        "created_at": "2020-05-14T01:43:21.365Z",
        "updated_at": "2020-05-14T01:43:21.365Z",
        "__v": 0
      }
    ]
  }
}
Server

Cowboy

Connection

keep-alive

X-Dns-Prefetch-Control

off

X-Frame-Options

SAMEORIGIN

Strict-Transport-Security

max-age=15552000; includeSubDomains

X-Download-Options

noopen

X-Content-Type-Options

nosniff

X-Xss-Protection

1; mode=block

Access-Control-Allow-Origin

*

Content-Type

application/json; charset=utf-8

Content-Length

391

Etag

W/"187-AN8aSc6fWli2FHZgkpqZ1kqga9w"

Vary

Accept-Encoding

Date

Thu, 14 May 2020 02:01:30 GMT

Via

1.1 vegur