Skip to content

Instantly share code, notes, and snippets.

@kugimiya
Created May 15, 2018 15:33
Show Gist options
  • Save kugimiya/511a6a6609c3a8a3b884ecb144b28d01 to your computer and use it in GitHub Desktop.
Save kugimiya/511a6a6609c3a8a3b884ecb144b28d01 to your computer and use it in GitHub Desktop.
REST API Description

REST API Description

About

Version: 0.1

Author: kugimiya

How it works

  • All API-methods named as URL
  • All requests must be sent by POST method
  • All parameters in request must be encoded as application/json
  • All parameters must be in the body of the POST request

Table of contents

  1. Auth Methods
  2. Messages Methods
  3. Types

Auth Methods

Register

URL: /auth/register

Parameters:

{
    email: string,
    first_name: string,
    last_name: string,
    password: string
}

Response: [StatusCode]

Log in

URL: /auth/login

Parameters:

{
    email: string,
    password: string
}

Response: [StatusCode, UserSession]

Log out

URL: /auth/logout

Parameters:

{
    session_id: string
}

Response: [StatusCode]

Messages Methods

Write message

URL: /messages/write

Parameters:

{
    session_id: string,
    message_text: string,
    message_recipient_email: string
}

Response: [StatusCode]

Get unreaden messages

URL: /messages/unreaden

Parameters:

{
    session_id: string
}

Response: [StatusCode, [Message, ...]]

Types

StatusCode

{
    type: 'error' || 'warning' || 'success',
    code: number,
    message: string
}

UserSession

{
    session_id: string
}

Message

{
    from: string,
    text: string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment