Stream: hapi
Topic: option to return the xml view
Eric Haas (Jun 09 2016 at 21:10):
Hi James. Is there a way to return the raw xml instead of the html? My use case may be unique but I'm interested in seeing the narrative view right on the browser when I fetch a resource.
Grahame Grieve (Jun 09 2016 at 21:11):
append _format=xml to the url
Eric Haas (Jun 09 2016 at 21:16):
doesn't work- still return the html view
Grahame Grieve (Jun 09 2016 at 21:17):
ahh oops
James Agnew (Jun 10 2016 at 00:02):
When HAPI detects that your request is coming from a browser it serves you up HTML instead of just the raw payload. There are two ways around this:
- HAPI supports a non standard parameter
_raw=true
which forces this to not happen - If what you actually want though is to just see the HTML of the narrative, you should be able to do this: http://fhirtest.uhn.ca/baseDstu3/Appointment/98975?_format=html
That second one appears to not be working though. Weird. I need to investigate that.
James Agnew (Jun 10 2016 at 00:04):
Would it be better for _format=xml
to just force raw XML instead of HTML-ifying it? I know that's how Grahame's server works and I can see the logic in it.. but that means there's no way of specifying that you explicitly want the pretty HTML version of JSON or XML, which at least I do all the time..
James Agnew (Jun 10 2016 at 01:55):
Actually, on closer inspection I guess _format=html
is intended to force the rendered HTML view you're trying to avoid. Nevermind that part.
Grahame Grieve (Jun 10 2016 at 02:38):
_format=xml should force raw xml in accordance with the spec. you could use _format=html/xml for htmlised xml or json. i could do that too
Grahame Grieve (Jun 10 2016 at 02:38):
what's with getXFirstRep? is this on any repeating element?
James Agnew (Jun 10 2016 at 02:50):
Hmm, yeah, that's not a bad idea to do something like html/xml
and html/json
. I'll make that change and try it out...
Yeah. getFooFirstRep() just returns the first repetition of a repeating field, creating it if it doesn't already exist. Semantic sugar.
Grahame Grieve (Jun 10 2016 at 03:07):
ok thanks. I'll add support for html/xml and html/json too at some stage
Last updated: Apr 12 2022 at 19:14 UTC