UTD-CRSS / exploreapollo-api

API server for the exploreapollo.org application
7 stars 4 forks source link

API Calls for Moment Viewer - Front end <=> API Server #5

Closed VictorK1902 closed 8 years ago

VictorK1902 commented 9 years ago

Imgur

I. Intro

Thought I would go ahead and create a separate issue to discuss and model API calls for this particular moment viewer

I break it into parts based on what we agreed weeks ago. From here, I'm expecting to set up the routes for front-end to make API call and request data.

The preview image can be updated as we go along.

II. Part 1 - Transcripts

We decided to have a separate end-point for transcript where the request takes 3 arguments: momentID, startTime and endTime. API server will respond with all transcripts of all channels fall within this time interval in (hopefully) chronological order

  1. Front-end

    /api/transcript?momentID=%s&startTime=%s&endTime=%s
  2. API server

    Return all transcripts of all channels in chronological order, with following data

    {
       "message"       : string,        
       "momentID"      : int,
       "startTime"     : string,
       "endTime"       : string,
       "transcripts"   : [
           {
               "id"         : int,
               "message"    : string,
               "met_start"  : bigint,
               "met_end"    : bigint,
               "channel_id" : int,
               "speaker_id" : int,
               "name"       : string
           },
           ...
       ]
    }

    Expected messages return for each api call: "Success", "Error connecting to database", "Incorrect metadata. Please try again", "At least one param is empty or mising. Please try again".

    Im hoping that the order of the objects within the array will be the order of the speaker transcript being appended to the chat box as well. Though, this question should be something I have to discuss with the DB module

  3. Sample API call and response:

    Imgur

  4. Questions??

    III. Part 2 - Moment Player

Simply the front end provides momentID. API server will respond with data as described below

  1. Front-end

    /api/moment?momentID=%s
  2. API Server

    {
       "message"         : string, 
       "title"           : string,
       "audioURL"        : string,
       "startTime"       : string,
       "endTime"         : string,
       "body"            : {}
    }

    Expected messages return for each api call: "Success", "Error connecting to database", "Empty momentID. Please try again", "Incorrect momentID. Please try again".

  3. Sample API call and response:

    Imgur

  4. Questions?

    IV. Part 3 - Body

Not sure what kind of data fron-end will need, or actually what kinda of data is available to a given moment beside transcripts. So I'm just going to leave it here for now.

  1. Front-end
  2. API Server
  3. Sample API call and response:
  4. Questions?