Skip to content

API Docs

Erik Zambom edited this page Feb 27, 2018 · 1 revision

Obs.: Every request has as response an json with the following info

  • message - Message to be displayed to the user in case of error
  • type - Not used
  • title - Title of alert to be displayed to the user in case of error
  • success - Boolean to tell if the request was a success
  • number - 1 in case of successful request
  • extra - Not used

Obs².: Every request, except the POST /api/token, need to have the Authorization header with the access token composed by the token_type and the access_token provided in the /api/token endpoint.


POST /api/token - Request access token

Parameters:

  • username - User's email used to access the platform
  • password - User's password used to access the platform

Succeeded response:

  • token_type - First part of access token
  • refresh_token - Not used
  • access_token - Second part of access token
  • scope - Not used
  • expires_in - Time in milliseconds until the token expires

POST /api/users/login - Sign in the system

Parameters:

  • email - User's email used to access the platform

Succeeded response:

  • data - object with user information such as: username, email, image_url, last_update, date_created, last_name, social_name, is_staff, is_active, description, unseen_msgs

POST /api/users/register_device - Register a mobile device for the logged user to provide app notifications

Parameters:

  • email - User's email used to access the platform
  • device - String containing the device id

Succeeded response:

  • No additional response

POST /api/subjects/get_subjects - Get list of subjects of a user.

Parameters:

  • email - User's email used to access the platform

Succeeded response:

  • subjects - list of objects of type subject that has information about the subjects such as: name, slug, visible, description_brief, notifications (This list lies inside of the data object in the json)

POST / api/participants/get_participants - Get all users that participates in some subject.

Parameters:

  • email - Email of the user doing the request
  • subject_slug - Identifier of the requested subject

Succeeded response:

  • participants - list of objects of type user that has information about the users that participate in the requested subject, excluding the one doing the request, such as: username, email, image_url, last_update, date_created, last_name, social_name, is_staff, is_active, description, unseen_msgs (This list lies inside of the data object in the json)

POST /api/chat/get_messages - Get messages of a conversation

Parameters:

  • email - Email of the user doing the request
  • user_two - Email of the other user in conversation

Succeeded response:

  • messages - list of objects of type chat that has information about the messages exchanged in the conversation, such as: text, user, subject, image_url, create_date, favorite, id (This list lies inside of the data object in the json)

POST /api/chat/send_message - Send a message in a conversation

Parameters:

  • email - Email of the user sending the message
  • user_two - Email of the user receiving the message
  • subject - Identifier of the subject attached in that message (if there's any)
  • text - Message body
  • create_date - Datetime of the message
  • file (Optional) - Image of the message

Succeed response:

  • message_sent - An object of the type chat that has the information about the message sent to the user, such as: text, user, subject, image_url, create_date, favorite, id (This object lies inside of the data object in the json)