Could a JSON representation be added for /tags
?
Requesting with the following HTTP header returns JSON:
X-Requested-With: XMLHttpRequest
You can try it for yourself with CURL:
curl "https://meta.discourse.org/tags" -H "X-Requested-With: XMLHttpRequest"
Although supporting the “.json” extension would make it the same as many other endpoints.
Tags can now have periods in them so that’s unfortunately not going to happen.
We lose a little discoverability but on the other hand only developers really want the JSON feeds and they can figure it out easily!
Ahh, got ya - that does make it awkward.
Thanks for clarifying the reasoning.
Could you confirm that adding the “X-Requested-With: XMLHttpRequest
” header is the correct (best) way to force JSON request?
It doesn’t seem quite specific enough - it feels like we should be requesting JSON rather than making adding the fake X-Requested-With
header.
Actually we support the Accept
header, so this approach is preferred as our API needn’t be consumed by XHR:
curl "https://meta.discourse.org/tags" -H "Accept: application/json"