Event API returns JSON as 'index.php'

Bug #589381 reported by Dave Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Helioviewer.org
Confirmed
Low
Unassigned

Bug Description

The Events API is returning requests with correctly formatted JSON, however it does so in a file called 'index.php' which incorrectly identifies the contents of the file.

Bonus Feature Request:

While this does not alter the ability for the file to be parsed, it does seem unclear. Further, it would be helpful if instead of something like 'events.json' the response could be something indicative of the type of API request made.

For example if the user were to request:

Catalogs: VSOService::noaa
Date: 2010-06-01T00:00:00
WindowSize: 86400

The response would be a file called:

VSOService::noaa_20100601T000000+86400.json

description: updated
Revision history for this message
Keith Hughitt (keith-hughitt) wrote :

Thanks for bringing this up. You make a good point: it would definitely be more intuitive to have the request return something like "VSOService::noaa_20100601T000000+86400.json" instead of "index.php." The main reason I haven't done this before is so that the API is easier to work with. In order to have the request return a .json file you can set the HTTP content-disposition header, e.g.:

header('Content-disposition:Attachment;filename=VSOService_noaa_20100601T000000+86400.json');

The main problem is that this will cause the browser to always attempt to download the file, so for developers interacting with the API, each time they try and modify the request to try something new they will have to download the file and open it in an external editor.

I should also note that since many browsers don't really understand what "application/json" is this is probably the default behavior of the browser anyways. There are a number of tools available, however, which allow you to work with the JSON result directly in the browser. JSONView for Firefox is one such tool.

A simple option might be to allow the user to set a "debug" parameter which could control which behavior should be used. For now though I'll just go ahead and update any JSON requests to return .json files.

Changed in helioviewer.org:
importance: Undecided → Low
status: New → Confirmed
Changed in helioviewer.org:
milestone: none → 2.4.0
Changed in helioviewer.org:
milestone: 2.4.0 → 3.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.