REST API Follow
The Meridian REST API is designed to allow integrations with our platform from 3rd party code. Only documented APIs are supported. Undocumented APIs are unsupported, subject to change, and should not be used.
URL Structure
The typical URL structure looks like this
https://edit.meridianapps.com/api/{resource1}/{id1}/{resource2}/{id2}
For example, to fetch data about about a specific placemark, make an HTTP GET request like this:
https://edit.meridianapps.com/api/locations/{location_id}/placemarks/{placemark_id}
As a concrete example, for location 12345678901234 and placemark 987654321987, you would use the following URL:
https://edit.meridianapps.com/api/locations/12345678901234/placemarks/987654321987
Get a List of Items
Requesting data from an endpoint without a specific ID will return a paginated list of items. Most paginated lists only return 100 items per page.
https://edit.meridianapps.com/api/locations/{location_id}/placemarks
Response Structure
The typical response body has three parts:
next |
String A URL to retrieve the next page of results |
previous |
String A URL to retrieve the previous page of results |
results |
List A list of the request results. |
Get the Next Page of Items
If the list of items is greater than the page size limit, the API will provide a URL to the next list page:
GET https://edit.meridianapps.com/api/locations/5468665088573440/beacons
This would return a result like:
{ "next": "https://edit.meridianapps.com/api/locations/5468665088573440/beacons?page=CkcKFAoHY3JlYXRlZBIJCOHC9ru17d0CEitqDnN-bWVyaWRpYW5lZGl0chkLEgdCZWFjb24yIgwwMDgxRjk0QjZDODkMGAAgAQ%3D%3D", "previous": null, "results": [ { /* ... */ }, { /* ... */ }, { /* ... */ }, // etc ] }
In order to fetch the next set of results, you would make an HTTP GET request to the next URL returned.
You will need to keep fetching data from the new next URLs until you finally get a response with next equal to null. This means you’re on the final page of the paginated response.
Javascript Example
If you wanted to fetch all data from a paginated endpoint using axios in JavaScript, you could use a function like the following:
export async function fetchAllPaginatedData(url) { const { data } = await axios.get(url); const results = data.results; let next = data.next; while (next) { const { data } = await axios.get(next); results.push(...data.results); next = data.next; } return results; }
The page_size
Property
The page_size
property should not be increased beyond the default value of 100
. Increasing the value of page_size
may cause endpoints to return very slowly, or not return as many items as you requested in page_size
, even if more items exist.
Comments
0 comments
Please sign in to leave a comment.