Users

GET /api/users

Get all users

Example request:

GET /api/users HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "users": [
      {
        "admin": true,
        "bio": null,
        "birth_date": null,
        "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
        "email": "admin@example.com",
        "first_name": null,
        "id": 1,
        "last_name": null,
        "location": null,
        "nb_activities": 6,
        "nb_sports": 3,
        "picture": false,
        "sports_list": [
            1,
            4,
            6
        ],
        "timezone": "Europe/Paris",
        "total_distance": 67.895,
        "total_duration": "6:50:27",
        "username": "admin"
      },
      {
        "admin": false,
        "bio": null,
        "birth_date": null,
        "created_at": "Sat, 20 Jul 2019 11:27:03 GMT",
        "email": "sam@example.com",
        "first_name": null,
        "id": 2,
        "last_name": null,
        "location": null,
        "nb_activities": 0,
        "nb_sports": 0,
        "picture": false,
        "sports_list": [],
        "timezone": "Europe/Paris",
        "total_distance": 0,
        "total_duration": "0:00:00",
        "username": "sam"
      }
    ]
  },
  "status": "success"
}
Parameters
  • auth_user_id (integer) – authenticate user id (from JSON Web Token)

Request Headers
Status Codes
  • 200 OK – success

  • 401 Unauthorized

    • Provide a valid auth token.

    • Signature expired. Please log in again.

    • Invalid token. Please log in again.

GET /api/users/(user_id)

Get single user details

Example request:

GET /api/users/1 HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "admin": true,
    "bio": null,
    "birth_date": null,
    "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
    "email": "admin@example.com",
    "first_name": null,
    "id": 1,
    "last_name": null,
    "location": null,
    "nb_activities": 6,
    "nb_sports": 3,
    "picture": false,
    "sports_list": [
        1,
        4,
        6
    ],
    "timezone": "Europe/Paris",
    "total_distance": 67.895,
    "total_duration": "6:50:27",
    "username": "admin"
  },
  "status": "success"
}
Parameters
  • auth_user_id (integer) – authenticate user id (from JSON Web Token)

  • user_id (integer) – user id

Request Headers
Status Codes
  • 200 OK – success

  • 401 Unauthorized

    • Provide a valid auth token.

    • Signature expired. Please log in again.

    • Invalid token. Please log in again.

  • 404 Not Found

    • User does not exist.

GET /api/users/(user_id)/picture

get user picture

Example request:

GET /api/users/1/picture HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: image/jpeg
Parameters
  • user_id (integer) – user id

Status Codes
GET /api/ping

health check endpoint

Example request:

GET /api/ping HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "message": "pong!",
  "status": "success"
}
Status Codes