Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add support for user preferences to be returned as JSON formatted response (API 0.6) #3160

Closed
donalhunt opened this issue Apr 4, 2021 · 3 comments · Fixed by #3164
Labels
api Related to the XML or JSON APIs

Comments

@donalhunt
Copy link

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:

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap server" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
  <preferences>
<preference k="diary.default_language" v="en"/>
  </preferences>
</osm>

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).

@gravitystorm
Copy link
Collaborator

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.

@gravitystorm gravitystorm added the api Related to the XML or JSON APIs label Apr 6, 2021
@migurski
Copy link
Contributor

migurski commented Apr 6, 2021

Can you point toward an example that we can copy, Andy?

@mmd-osm
Copy link
Contributor

mmd-osm commented Apr 6, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the XML or JSON APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants