Skip to content

New features API

Wille Marcel edited this page Jul 1, 2019 · 4 revisions

The new features endpoint will store the features data as a JSONField of its changeset. A compatibility endpoint will be maintained for some time so we can do a smooth switch.

Features input

New endpoint

URL: /api/v1/changesets/add-feature/

{
   "osm_id": "4321",
   "changeset": 1234,
   "osm_type": "node",
   "reasons": ["Other reason", "Large building"],
   "version": 54,
   "name": "Tall Building",
   "primary_tags": {"office": "coworking", "building": "yes"},
   "note": "details about the suspicion"
}

The first four fields are required, the others are optional. Reasons can receive also a list of ids, instead of a list of names. Any other field you add to the request content will not be saved on the database. Check the list of existing suspicion reasons, if you want to flag features with another reason, just add the name of the new reason inside the reasons field and it will be created when the request is received by the server.

Old format endpoint

URL: /api/v1/features/create/

This endpoint will be maintained for some time to give time to the tools that post features to OSMCha to switch. The old format example can be found here.

Features output

The features will be serialized only in the changesets view, on the same features field that we always had. The new serialization is very similar to the previous one, so the compatibility will be maintaned. We have some new fields and the main change is that it will return only the id of the Suspicion Reasons, instead of its name and id.

[{
   "osm_id": "4321",
   "url": "node-4321",
   "reasons": [1, 22]
   "version": 54,
   "name": "Tall Building",
   "primary_tags": {"office": "coworking", "building": "yes"},
   "note": "details about the suspicion"
}]

Permissions

Only staff users have permissions to post features to OSMCha. If you would like to monitor some kind of feature changes and would like to have it registered in OSMCha, please contact-us opening a GitHub issue or on our mailing list.

Clone this wiki locally