Skip to content

Home API

Dan Calacci edited this page Oct 11, 2016 · 4 revisions

API Documentation

This is the API documentation for the Rhythm Server. This API should be used by authorized users for data analysis or for writing a custom Rhythm Client.

Most endpoints here are feathersjs services, which means you can read about how to query them in the [feathersjs docs](http://docs.feathersjs.com/)

Authentication

Authentication is done [by the book](http://docs.feathersjs.com/), using JWT. To authenticate requests to the API, you must include a JWT token with your request. To obtain a JWT token, you can either send a POST request to /auth/local on the server, or use the feathers-client nodejs module to authenticate.

Rest:

POST http://server.uri/api/local

{'email': email_here,
 'password': password_here}

You should receive a code 200 response from the server with the JWT token in the header.

feathers-client

const feathers = require('feathers-client')

var socket = io.connect('http://uri.to.server', {
  'transports': [
    'websocket',
    'flashsocket',
    'jsonp-polling',
    'xhr-polling',
    'htmlfile'
  ]
})

const client = feathers()
  .configure(feathers.socketio(socket))
  .configure(feathers.hooks())
  .configure(feathers.authentication())

client.authenticate({
      type: 'token',
      email: 'insert-email',
      password: 'insert-password'
    })

Services

Meetings

url: /participants

The meetings API endpoint corresponds to all meetings that have been saved on the server to date. Meetings have the following fields:

Field Name Data Type Description
participants [String] All IDs of active participants of this meeting. As soon as a participant leaves a meeting, they are no longer stored in this field. For historical participant information, refer to the participantEvent service.
startTime Date Start time of this meeting
endTime Date End time of this meeting. Undefined until a meeting ends. Meetings occasionally re-start (if people return to the same “meeting” in a client), so this is not constant once set.
active Boolean True if a meeting is currently active (there are participants in it). False otherwise.
meetingUrl String URL of a meeting, if it has one
meta JSON Object Unstructured metadata. The meta field can be used to store unstructured data in a meeting object that a client can query against. It’s commonly used to store group name or project identifiers

The meetings endpoint can be queried like a normal endpoint, except for the meta field. Right now, we only support direct matching in the meta field, so you cannot use feathersjs’ query language for meta objects – just direct matching.

i.e. {meta: {a: 1}} will match objects with {meta: {a: 1}}. You cannot do a complex query like {a: {‘$lt’: 4}.

Participants

Field Name Data Type Description
name String Name of participant
meetings [String] List of meeting IDs that this participant has been in.
consent Boolean True if this participant has given consent for data collection
consentDate Date The date that this participant gave consent
createdAt Date the date that this resource was created
updatedAt Date the last date this resource was updated or patched at.

meetings and participants have a special relationship. To add a participant to a meeting, do not alter the participant object. Instead, add and remove participants through the meetings endpoint. When you add a participant to a meeting through the participants endpoint, hooks are not run properly. This means that when you add a participant to an empty meeting through the participants endpoint, the meeting will not automatically be marked as active, while if you add the participant through the meetings endpoint, it will.

API Documentation

This is the API documentation for the Rhythm Server. This API should be used by authorized users for data analysis or for writing a custom Rhythm Client.

Most endpoints here are feathersjs services, which means you can read about how to query them in the [feathersjs docs](http://docs.feathersjs.com/)

*Services

Meetings

url: /participants

The meetings API endpoint corresponds to all meetings that have been saved on the server to date. Meetings have the following fields:

Field Name Data Type Description
participants [String] All IDs of active participants of this meeting. As soon as a participant leaves a meeting, they are no longer stored in this field. For historical participant information, refer to the participantEvent service.
startTime Date Start time of this meeting
endTime Date End time of this meeting. Undefined until a meeting ends. Meetings occasionally re-start (if people return to the same “meeting” in a client), so this is not constant once set.
active Boolean True if a meeting is currently active (there are participants in it). False otherwise.
meetingUrl String URL of a meeting, if it has one
meta JSON Object Unstructured metadata. The meta field can be used to store unstructured data in a meeting object that a client can query against. It’s commonly used to store group name or project identifiers

The meetings endpoint can be queried like a normal endpoint, except for the meta field. Right now, we only support direct matching in the meta field, so you cannot use feathersjs’ query language for meta objects – just direct matching.

i.e. {meta: {a: 1}} will match objects with {meta: {a: 1}}. You cannot do a complex query like {a: {‘$lt’: 4}.

Participants

url: /participants

Field Name Data Type Description
name String Name of participant
meetings [String] List of meeting IDs that this participant has been in.
consent Boolean True if this participant has given consent for data collection
consentDate Date The date that this participant gave consent
createdAt Date the date that this resource was created
updatedAt Date the last date this resource was updated or patched at.

meetings and participants have a special relationship. To add a participant to a meeting, do not alter the participant object. Instead, add and remove participants through the meetings endpoint. When you add a participant to a meeting through the participants endpoint, hooks are not run properly. This means that when you add a participant to an empty meeting through the participants endpoint, the meeting will not automatically be marked as active, while if you add the participant through the meetings endpoint, it will.

participant events

url: /participantEvents

*Field Name* Data Type Description
participants [String] List of participants in a given meeting
meeting String Meeting ID
timestamp Date timestamp of this event

participantEvents logs the list of participants in a given meeting at any point in time. This serves as the historical record of the participants that have joined a meeting.

utterance

url: /utterances

*Field Name* Data Type Description
participant String participant ID that this utterance was spoken by
meeting String meeting ID that this utterance was spoken in
startTime Date start time of this utterance
endTime Date end time of this utterance
volumes [{‘timestamp’: String, ‘vol’: Number }] list of volumes for each sample taken from the audio data. Does not have to be included in the data for the system to work properly, but send the volumes to be able to re-calculate speaker events later.

Utterances represent periods of time when individual users were speaking in the meeting. If you try to create two utterances that look like they are the same, the second will fail silently and not be added to the database.