-
Notifications
You must be signed in to change notification settings - Fork 13
Public API
Participedia expose our data via an API. To get started, please contact us to receive a free API key, which needs to be added to the HTTP header (API_KEY
) to be able to access our API.
Participedia exposes a REST API that allows an authorized application perform HTTP GET
operations to retrieve a paginated list of cases, methods or organization. The API request parameters are uniform across all three result types, but returned results are not uniform in structure.
All requests to the API are required to be authorized using an API key. An unauthorized request or incorrectly authorized request will result in a 401 Unauthorized
response code with the response below:
{
"error": "Invalid Participedia API Key"
}
To authorize a request, set the API-KEY
authorization header to your issued API key value. A NodeJS example request is given below:
const request = require('request');
const options = {
'method': 'GET',
'url': 'https://participedia.net/api/v1/cases',
'headers': {
'API-KEY': 'YOUR_API_KEY_HERE'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
All API requests are made to the base URL endpoint with the resource name and optional parameters.
The API base URL endpoint is https://participedia.net/api/v1
and resource names can be one of /cases
, /organizations
or /methods
. If none of the optional parameters are given, the API returns the latest 50 entries for the given resource. Otherwise, the API returns results that are filtered by the parameters.
Available parameters can be one or more of the options listed in the table below:
Parameter | Type | Default | Notes |
---|---|---|---|
skip | number | 0 | Number of entries to skip before selecting results to return. |
limit | number | 50 | Maximum number of entries to return from the API. Maximum is 200
|
sortKey | string | post_date | Resource column name by which the returned response is sorted. To sort results in decending order a minus sign (-) is added before the sort key, otherwise, the result is sorted in ascending order. Note: The sort key may vary by resource type |
A request to retrieve the oldest 50 methods, sorted by last updated date will look like below:
https://participedia.net/api/v1/methods?skip=0&limit=50&sortKey=-updated_date
Note: Only English language results are currently returned by the API
Successful requests result in a 200 Ok
response code that returns a JSON object with a single key that matches the requested resource' name, and a value that is a JSON array of requested resource values, For example, a request to fetch cases
will return a JSON array in the format below:
{
"cases": [] // Array of cases
}
An authorized request that fails will return a 400 Bad Request
response code with a JSON object that is in the format below:
{
"error": "Error message" // Reason for request failure
}