Closed donalhunt closed 3 years ago
Yep, at the moment only some of the API calls have json responses. I'm happy to see PRs to include more of the endpoints, or ideally all of them.
Can you point toward an example that we can copy, Andy?
This user added some JSON stuff back in Sep 2020, and earlier: https://github.com/openstreetmap/openstreetmap-website/commits?author=mmd-osm
That’s all you need to know to get started.
Discovered that while the
/api/0.6/user/details
endpoint will provide a json response, the/api/0.6/user/preferences
endpoint does not. :(GET /api/0.6/user/details with "Accept: application/json" header:
{"user":{"id":12345,"display_name":"firstname surname","account_created":"1970-01-01T18:18:36Z","description":"","contributor_terms":{"agreed":true,"pd":false},"img":{"href":"https://www.gravatar.com/avatar/00000000000000000000000000.jpg"},"roles":[],"changesets":{"count":0},"traces":{"count":0},"blocks":{"received":{"count":0,"active":0}},"languages":["en-GB", "en"],"messages":{"received":{"count":0,"unread":0},"sent":{"count":0}}}}
GET /api/0.6/user/preferences with "Accept: application/json" header:
Looking at the codebase, this doesn't look particular hard to implement but I wanted to a) flag it as an issue and b) check if it would be worthwhile investing the time implementing it (e.g. by submitting a PR).