Skip to content

User Service

Cody Ley-Han edited this page Apr 9, 2018 · 6 revisions

Types

User

{
    "id": {
        "description": "Unique identifier",
        "type": "string"
    },
    "email": {
        "description": "user's email",
        "type": "string"
    },
    "profile_image": {
        "description": "profile image",
        "type": "string"
    },
    "auth_level": {
	"description": "the level at which the user is authorized",
	"type": "int"
    },
    "created_at": {
        "type": "string",
        "format": "date-time in RFC3339 format"
    },
    "updated_at": {
        "type": "string",
        "format": "date-time in RFC3339 format"
    }
}

Auth Level

These are represented as ints

0. User
1. Admin 

Token Claims

{
    "id": {
        "description": "Unique identifier",
        "type": "string"
    },
    "email": {
        "description": "user's email",
        "type": "string"
    },
    "auth_level": {
        "description": "the user's current auth level high, 0 is least priviliged",
        "type": "int"
    }
}

Endpoints

List: GET /api/v1/users/

Authorization: Admin Request Optional Query Params

limit : an integer between 1 and 100 for the number of entities to return, default = 15
last : the id of the last entity on the last seen page, default = ''

Response

{
    "data": ["User"]
}

Show: GET /api/v1/users/:id

Response

{
    "data": "User"
}

Show current user info: GET /api/v1/users/@me

Get information about the current user

Response

{
    "data": "User"
}

Create: POST /api/v1/login

Request

{
    "token": {
        "description": "token string provided by google oAuth",
        "type": "string"
    }
}

Response

{
    "data": "JWT token string"
}