Skip to content

API Documentation

Emil Abraham edited this page Mar 11, 2019 · 10 revisions

Authorization

Authorize User - POST /auth

BODY:

  • user_email
  • user_password

RETURNS:

  • message - "Authorized" if successful
  • token - The JWT token that will be used as bearer token for all other functions

Users

GET /user/me

A simple function to return the authorized user's information to test authentication token

AUTHORIZATION: bearer

RETURNS: User object saved in the JWT

GET /user/all

A simple function to return all users and their information from the database

AUTHORIZATION: bearer

RETURNS: All Users

  • user_id - user id
  • user_email - user's email
  • user_password - user's password (development purposes)
  • org_id - User's organization id
  • first_name - User's first name
  • last_name - User's last name
  • create_time - User's time created

GET /user/generators

A simple function that returns an authorized user's generators (currently logged in user)

AUTHORIZATION: bearer

RETURNS:

  • gen_id - generator's id
  • org_id - generator's organization id
  • gen_name - generator's name
  • zip - generator's zip code

Generators

GET /generators/:gen_id

A simple function that returns a generator's basic information

AUTHORIZATION: bearer

RETURNS:

  • gen_name - generator's name
  • state - generator's state location
  • zip - generator's zip code

Organizations

GET /org/:org_id

A simple function that returns an organization's information

AUTHORIZATION: bearer

RETURNS:

  • org_id - organization's id number
  • org_name - organization name
  • state - organization's state location
  • zip - organization's zip code

Data

GET /data/query

Wraps the OpenTSDB /api/query functionality.

Follow the API requirements on this page to change form queries and expect responses.

AUTHORIZATION: bearer


Admin

Register New User - POST /admin/register

AUTHORIZATION: bearer + admin role (not implemented yet)

BODY:

  • user_email
  • user_password
  • organization_id
  • first_name
  • last_name

RETURNS:

  • message - "Created User" if successful
  • user_id - Newly created user's id