Skip to content

New features API

Wille Marcel edited this page Sep 19, 2018 · 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. A reason needs to be created previously in the database before using it.

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"
}]
Clone this wiki locally