-
Notifications
You must be signed in to change notification settings - Fork 1
Web API (Badger State)
Jason Bertsche edited this page Jun 27, 2019
·
6 revisions
All API methods expect to receive the parameters as content type application/x-www-form-urlencoded.
- Method: POST
-
Parameters:
-
group-id: The identifier that is being used for the class/group that subsequent data should be connected with
-
-
Response Type:
text/plain -
Description: Generates a unique identifier for the requester that will be used for sending/receiving subsequent data. Ensures that the unique identifier will be available in the response from
/badgerstate/participants. Responds with the unique identifier. -
Error Conditions:
-
group-idis missing or empty (HTTP 422)
-
- Method: GET
-
Parameters:
-
group-id: The identifier of the class/group in question
-
-
Response Type:
application/json -
Description: Responds with a JSON array of strings of unique identifiers of members of the group (as generated by
/badgerstate/join), where the array is ordered by join time, such that the first identifier is the most recent joiner and the last identifier is the least recent joiner. -
Error Conditions:
-
group-idis missing or empty (HTTP 422)
-
- Method: POST
-
Parameters:
-
group-id: The identifier of the class/group associated with the bucket -
bucket-id: The identifier (UUID) of the bucket itself, as returned by/badgerstate/join -
data: The arbitrary data to be stored
-
-
Response Type:
text/plain - Description: Stores the data on the server for future retrieval. Responds with the POSIX timestamp (in microseconds) for when the data was added to the database.
-
Error Conditions:
-
group-idis missing or empty (HTTP 422) -
bucket-idis missing or an invalid UUID (HTTP 422) -
datais missing or empty (HTTP 422)
-
- Method: GET
-
Parameters:
-
group-id: The identifier of the class/group associated with the bucket -
bucket-id: The identifier (UUID) of the bucket itself, as returned by/badgerstate/join -
timestamp: The POSIX timestamp (in microseconds) that all returned results must be newer than
-
-
Response Type:
application/json -
Description: Responds with a JSON array of all data that was uploaded to the bucket after
timestamp. The values in the JSON array are JSON objects of the form{ "value": <string>, "timestamp": <number> }. -
Error Conditions:
-
group-idis missing or empty (HTTP 422) -
bucket-idis missing or an invalid UUID (HTTP 422) -
timestampis missing or an invalid number (HTTP 422)
-
- Method: GET
-
Parameters:
-
group-id: The identifier of the class/group associated with the bucket -
bucket-id: The identifier (UUID) of the bucket itself, as returned by/badgerstate/join -
n: The number of data updates to be returned (starting with the most recent);
-
-
Response Type:
application/json -
Description: Responds with a JSON array of the latest
nentries in the bucket. If0is given forn, the response will contain all of the data in the bucket. The values in the JSON array are JSON objects of the form{ "value": <string>, "timestamp": <number> }. -
Error Conditions:
-
group-idis missing or empty (HTTP 422) -
bucket-idis missing or an invalid UUID (HTTP 422) -
nis missing or not a non-negative integer (HTTP 422)
-
- Method: POST
-
Parameters:
-
group-id: The identifier of the class/group associated with the bucket -
bucket-id: The identifier (UUID) of the bucket itself, as returned by/badgerstate/join -
signal: The arbitrary signal to be stored
-
-
Response Type:
text/plain -
Description: Stores the data on the server for future retrieval. Unlike with
/badgerstate/data, each bucket has at most one signal. Responds with the POSIX timestamp (in microseconds) for when the data was added to the database. -
Error Conditions:
-
group-idis missing or empty (HTTP 422) -
bucket-idis missing or an invalid UUID (HTTP 422) -
signalis missing or empty (HTTP 422)
-
- Method: GET
-
Parameters:
-
group-id: The identifier of the class/group associated with the bucket -
bucket-id: The identifier (UUID) of the bucket itself, as returned by/badgerstate/join
-
-
Response Type:
text/plain -
Description: Responds with a string of format
<timestamp> | <signal>. It is highly advised that you check the check the timestamp on the signal for staleness before reacting to the signal. -
Error Conditions:
-
group-idis missing or empty (HTTP 422) -
bucket-idis missing or an invalid UUID (HTTP 422) - There has not yet been a signal stored for this bucket (HTTP 404)
-