Skip to content
Wille Marcel edited this page Mar 5, 2019 · 8 revisions

How to use the OSMCha API

Our API is very useful when you need other software to process the OSMCha data. Check some instructions on how to start using it.

Filtering changesets

Go to the Filters page, and fill the desired filter parameters to search for changesets. Apply the search to check the results. If it gave you the results that you wanted, save the filter.

Getting the token

Go to your OSMCha user page and copy your Token.

Reaching the API

Open another tab in your browser, access https://osmcha.mapbox.com/api-docs/#!/aoi/aoi_changesets_list and click on the Authorize button. Paste Token <the_token_code_you_copied_from_your_user_page> and click on the authorize button.

Important: remember to add the word Token before you token value.

Go back to the other OSMCha tab and copy the id of the filter that you saved (it's available on the tab URL or on the Saved Filters section of your user page. Paste it in the id field of the get /api/v1/aoi/{id}/ section.

The response will be a GeoJSON, containing the BBOX of the changeset and all metadata we have registered on our database.

Note: saving a filter is the easiest way to make that API query, but if you want, you can pass the filters params directly to the changesets endpoint (https://osmcha.mapbox.com/api-docs/#!/changesets/changesets_list).

Pagination

To navigate through the results page, add the page param. And to define the number of changesets returned on each page, add the page_size param. For example: ?page=2&page_size=30.

Using other software to reach the API

  • curl

curl -X GET --header 'Accept: application/json' --header 'Authorization: Token <your-token>' 'https://osmcha.mapbox.com/api/v1/aoi/<aoi_id>/changesets/'

Note: the word Token needs to be present in the Authorization header, otherwise it will not work.