Skip to content

API design

Grant Mercer edited this page Apr 19, 2017 · 42 revisions

This document contains all proposed API features offered by the backend, and explanations of each feature.

Table of Contents

Public API

News (/news/:conf)

  • Proposed HTTP methods: GET
  • Body: None
  • Function: Returns a JSON object containing a list of news objects to display on the home page
  • Returns: [ /* any # of: */ { title: string, logo: string, text: string } ]

Info (/info/:conf)

  • Proposed HTTP methods: GET
  • Body: None
  • Function: Returns a JSON object containing info from conference table (name/location/time)
  • Returns: { ConfName: string, StartDate: date, EndDate: date, Location: varchar }

Schedule (/schedule/:conf)

  • TBD

Exhibitors (/exhibitors/:conf)

  • Proposed HTTP methods: GET
  • Body: None
  • Function: Returns a JSON object containing list of exhibitors
  • Returns: { exhibitors: [ /* TBD */ ] }

Private API

Login (/login)

  • Proposed HTTP Methods: POST
  • Body: { Auth0Token, loginType: string, conference: string } (Auth0Token Example)
  • Function: Checks if user has login privileges from appropriate table, creates user database entry if new, otherwise pulls metadata from database entry and returns token with metadata
  • Returns: { user_data } | ErrorCode

User (/user/:id)

  • Proposed HTTP Methods: GET, PATCH
  • Body(PATCH only): { in_user_data }
  • Function:
    • PATCH: Modifies user database fields specified inside in_user_data
    • GET: Returns user data in json_format
  • Returns: { user_data }

Image (/img)

  • Proposed HTTP Methods: POST
  • Body: { image: Object }
  • Function: Uses the Imgur API to upload the posted image and return a link which is then used by the frontend / stored by the database. Note no database modification will be made in this route, it will only upload images to the Imgur API and return a link to the frontend
  • Returns: { link: string }

Edit Conference (/edit/conference/:conf)

  • Proposed HTTP Methods: PATCH
  • Body: { source: unique_id, fields: { /* fields to replace */ } }
  • Function: Checks permissions of user source, and if allowed to update (is conference organizer) replace all columns appearing fields with new data supplied by post object
  • Returns: { status: int }

Edit News (/edit/news/:conf)

  • Proposed HTTP Methods: POST
  • Body: { source: unique_id, news_item: { title: string, text: string, logo: string } }
  • Function: Checks permissions of user source, and if allowed to update (is conference organizer) add news_item as a new row in the news table
  • Returns: { status: int }

Edit Exhibitor List (/edit/exhibitors/:conf)

  • Proposed HTTP Methods: POST
  • Body: { source: unique_id, email: string }
  • Function: Checks permission of user source, if allowed (is conference organizer) then adds email to permitted exhibitors
  • Returns: { status: int }

Edit Schedule (/edit/schedule/:conf)

  • TBD
Clone this wiki locally