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
allow servers to give info response as human readable HTML instead of JSON #101
Comments
There are likely going to be other servies that get described in the Perhaps the |
We explored wether we could close this, but there is still enough interest that it needs discussion. It's lower priority than other issues, so we are holding off further discussion and decisions for now. Everyone thinks that it would be good to have a convenient way for users to learn how to use a server - that showing humans (i.e. browsers) more than just raw JSON would be useful for an info response. The debate is about where to add that functionality. Maybe a separate service provides this for all HAPI servers. Or maybe the standard server implementation provides this capability, so most servers get it for free. It's optional anyway. Or perhaps, a server should advertise wether it can do this - via the existing |
For people that want to do this, the spec should give an indication of how, so that we don't end up with many ways of doing it. |
no one is pushing this now - need to find a champion or we should close it |
The best way to handle this is to have the web server (that is presenting the HAPI info) do the rendering of the HAPI JSON metadata. This means HAPI servers focus only on the JSON, which is machine readable, and the HAPI spec does not need to get into the details of HTML rendering. Also, the web portal showing the HTML can use HTML that is consistent in look and feel to the rest of the web site. Closing since no changes to the spec are going to be done for this. |
This came up when talking about how to represent HAPI access in a SPASE element.
Bernie suggested that if a HAPI server gets a request with an Accept header indicating HTML preference, this means it's a browser, so a human readable HTML response is appropriate.
This issue proposes that the spec be changed to allo HAPI servers to do this. The HTML that they return would be server specific, and could include instructions to humans with code snippets about how to access the data via Python, IDL, Matlab, etc.
The default (given no Accept header) would be JSON, and servers would not need to pay attention to the HTML request.
Here is Bernie's description of what he did in his original CDAWeb HAPI server:
here's an example of my info response that requires no change to HDP (the reason I did it) if it were used in a spase NumericalData/AccessInformation/AccessURL/URL element:
https://cdaweb.gsfc.nasa.gov/registry/hdp/hapi/info?id=spase://NASA/NumericalData/ACE/MAG/L2/PT16S
When viewed with a browser, you'll see html because browsers sends an Accept header with a value something like " text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8". But if you do
$ curl -s "https://cdaweb.gsfc.nasa.gov/registry/hdp/hapi/info?id=spase://NASA/NumericalData/ACE/MAG/L2/PT16S" | jq
or
$ curl -s -H "Accept: application/json" "https://cdaweb.gsfc.nasa.gov/registry/hdp/hapi/info?id=spase://NASA/NumericalData/ACE/MAG/L2/PT16S" | jq
you'll get JSON (or XML if you specify "application/xml").
Note that this could potentially also apply to other endpoints.
The text was updated successfully, but these errors were encountered: