Skip to content

API design

lilylei95 edited this page Apr 26, 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, author: string } ]
    • Implemented

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 }
  • Implemented

Schedule (/schedule/:conf)

  • Proposed HTTP methods: GET
  • Body: None
  • Function: Returns a JSON object containing list of schedule event objects
  • Returns: [ /*any # of*/ { "start": string, "end": string, "name": string, "color": Object, "resizable": Object, "draggable": boolean }]
    • Implemented

Exhibitors (/exhibitors/:conf)

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

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
    • Implemented

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 }
    • Implemented

User (/user/exhibitors/:conf)

  • Proposed HTTP Methods: GET
  • Function:
    • GET: Returns list of all exhibitor users for a conference
  • Returns: [ /* any # of: */ { email: string, name: string, company: string }]
    • Implemented

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 }
    • Implemented

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 }
    • Implemented

Edit News (/edit/news/:conf)

  • Proposed HTTP Methods: POST, DELETE
  • Body: { source: unique_id, news_item: { title: string, text: string, logo: string, author: 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 }
    • Implemented

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

  • Proposed HTTP Methods: POST
  • Body: { source: string, email: string }
  • Function: Checks if source is allowed, then adds email and conference_id to permitted exhibitors table
  • Returns: [ /*any # of:*/ { title: string, logo: string, text: string, author: string } ]
    • Implemented

Edit Schedule (/edit/schedule/:conf)

  • Proposed HTTP methods: PATCH
  • Body: [ */any # of*/ { "start": string, "end": string, "name": string, "color": Object, "resizable": Object, "draggable": boolean }]
  • Function: Returns a JSON object containing list of schedule event objects
  • Returns: [ */any # of*/ { "start": string, "end": string, "name": string, "color": Object, "resizable": Object, "draggable": boolean }], or error
    • Implemented