- Legion API
- Events
- Get organization events
Get organization events
const url = 'https://us-gov.legion.picogrid.com/v2/events?paging_direction=forwards';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://us-gov.legion.picogrid.com/v2/events?paging_direction=forwards'Gets all events for your organization paginated. You are only allowed to access this endpoint if your token is authorized to read from every terminal in your organization
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The maximum number of items to return with a default value of 10. Note that a request never returns more than about 1MB of data irrespective of how high this value is
The cursor given by your previous request used to get the next page of results. Defaults to start from the beginning if forwards and end if backwards
The direction for the pagination cursor. Defaults to backwards
The id of the organization to get stream hls url for
This parameter allows you to filter by a specific event type in your query. If not specified all events of any event type will be fetched
The earliest timestamp you want included in your query. It defaults to the beginning of time. The format is a string containing an integer in epoch milliseconds as explained further here: https://en.wikipedia.org/wiki/Unix_time
The latest timestamp you want included in your query. It defaults to the end of time. The format is a string containing an integer in epoch milliseconds as explained further here: https://en.wikipedia.org/wiki/Unix_time
Responses
Section titled “Responses”Success
object
object
This key can be used as a discriminator for which type of event you have received. In this case the value is ‘blob’. The fragment this event occurred on is stored in our blob storage, which we use for large files and unstructured data, so we provide the fragment to you via the presigned url found in this object.
An http url you can send a GET request to in order to fetch the blob data of the fragment this event occurred on. If it is an image for example you can use this url directly in an <img> tag to display the image. The url is only valid for 24 hours, so will need to be refetched after that time if needed. The url should be treated as a secret token, and only shared with people you want to have access to the data.
The confidence of the processor that it classified the event correctly as a percentage from 0-100
The time which this event occurred at. The timestamp is an epoch milliseconds integer. See https://en.wikipedia.org/wiki/Unix_time for more information
The time the event was created. The timestamp is an epoch milliseconds integer. See https://en.wikipedia.org/wiki/Unix_time for more information
Gives multiple different formats and units to choose between that all represent the location of the resource
object
Provides the latitude and longitude of the resource using WGS84, and the altitude of the resource in meters above sea level
object
The altitude of the resource in meters above sea level
Any additional metadata that the processor wanted to add to the event. See meta_data documentation for more information
object
object
This key can be used as a discriminator for which type of event you have received. In this case the value is ‘json’. The fragment this event occurred on is stored as a json object smaller than 200kb and is therefore provided directly in the json_data key in this object.
The json data which describes the fragment this event occurred on
object
The confidence of the processor that it classified the event correctly as a percentage from 0-100
The time which this event occurred at. The timestamp is an epoch milliseconds integer. See https://en.wikipedia.org/wiki/Unix_time for more information
The time the event was created. The timestamp is an epoch milliseconds integer. See https://en.wikipedia.org/wiki/Unix_time for more information
Gives multiple different formats and units to choose between that all represent the location of the resource
object
Provides the latitude and longitude of the resource using WGS84, and the altitude of the resource in meters above sea level
object
The altitude of the resource in meters above sea level
Any additional metadata that the processor wanted to add to the event. See meta_data documentation for more information
object
object
Is false in this case which means you have reached the end of available results
object
Is true in this case which means there are more pages to be fetched
The cursor specifying your current pagination progress used to fetch next pages. Is only present if has_more is true
Example
{ "data": [ { "primitive_fragment_type": "blob" } ], "pagination": { "has_more": false }}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Bad Request Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Authentication Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Unauthorized Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Resource Not Found Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Timeout Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Bad Gateway Error
object
Examplegenerated
{ "message": "example"}Headers
Section titled “Headers”The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the request’s credentials mode (Request.credentials) is include. - MDN Link
Version 2 · commit 0771262
