Skip to content

API V2 changes from V1

eosrei edited this page Sep 19, 2014 · 1 revision

The V1 API is located at /api/1 and /api/1/rest. A fully RESTful V2 API will be at /api/2.

Organized by v1 API operation

get_config

Create new session for project when client establishes connection:

POST api/2/sessions

If client already has device_id, it should be included as a parameter to indicate to the server that a new device_id needn't be created and to be recorded in the new session record to establish a connection between all sessions for the same device.

Then retrieve data from project, speaker and audiotrack models related to project:

GET api/2/projects/:id

get_tags

GET api/2/projects/:id/tags

I am not sure how best to RESTfully include the optional session_id parameter.My gut tells me that optional parameters can be consistently included as a query argument rather than part of the URL path, but I have not found clear best practices. In other words, in this case, if the client wanted to include the session_id, which is used to determine the localization of the session, the request would look like this:

GET api/2/projects/:id/tags?session_id=1

Session ID will be handled by authentication, details TBD

request_stream

A basic request for new stream, not plural because you get one per authentication:

POST api/2/stream

A request for a new stream with additional optional parameters:

POST api/2/stream?project=1&latitude=1&longitude=1&tags=1,2,3&audio_stream_bitrate=128

modify_stream

Modifying the tag filters of an existing stream:

PATCH api/2/stream/?tags=1,2,3

move_listener

Change the location of the listener for an existing stream (geo_listen_enabled projects only):

PATCH api/2/stream/?latitude=2&longitude=2

get_current_streaming_asset

GET api/2/stream/current

play_asset_in_stream

PUT api/2/stream/current/:aid

skip_ahead

PATCH api/2/stream/actions/next

heartbeat

POST api/2/stream/actions/heartbeat

create_envelope

POST api/2/envelopes/

additional parameter:

session_id

add_asset_to_envelope

POST api/2/envelopes/:id/assets/:id

additional parameters:

latitude
longitude
tags
mediatype
file
submitted

get_asset_info

GET api/2/assets/:id

get_available_assets

GET api/2/projects/:id/assets/?tagids=26,36&latitude=47.654139&longitude=-122.335914&radius=500&mediatype=audio

additional optional parameters:

envelope_id
language

log_event

POST api/2/events/

including data:

session_id
event_type
latitude
longitude
tags

vote_asset

POST api/2/assets/:id/actions/vote/[type]