JSON Overview

Using JSON with OxAPIs

JSON is a lightweight alternative to XML, and has been widely adopted throughout the web. The rest of this document assumes you're familiar with JSON, but if you aren't, check out Introducing JSON, JSON: The Fat-Free Alternative to XML, and the JSON Wikipedia entry.

JSON has a few special characteristics worth mentioning here:

  • JSON is language-independent. You don't need to use JavaScript.
  • JSON objects are collections of name-value pairs. Each object is enclosed in curly brackets ({}).
  • Each name-value pair is seperated by a comma. The name is seperated from the value by a colon (:).
  • Add /JSON to the URL to get JSON responses from OpenX
  • Add the query parameter "callback=myFunction" to get your JSON wrapped in an object. This can help avoid browser restrictions.


The OpenX API returns data in XML format by default, but that doesn't mean you can't get JSON back if you want it. Just make one little change to the URL you call and OpenX will return JSON responses instead.

To get JSON responses, insert a /JSON after the service name (such as "PBMClaimV1") in the URL, but before the method name ("Get"). When we see that URL, we'll return JSON insead.

Instead Of This

https://secure.heatlhx.com/API/PBMClaimsV1/SearchByMemberID/

Call This To Get JSON

https://secure.heatlhx.com/API/PBMClaimsV1/JSON/SearchByMemberID/

That's it. No assembly required.

If you want to wrap your response in an object, simply pass the object name into your query as the "callback" value. For example:

To Get Your JSON in a Callback

https://secure.heatlhx.com/API/PBMClaimsV1/SearchByMemberid/
?appid={appid}
&serviceid={serviceid}
&Timestamp={Timestamp}
&SignatureVersion={SignatureVersion}
&Signature={Signature}
&payororgid={payororgid}
&groupnum={groupnum}
&memberid={memberid}
&query={searchQuery}
&callback=myFunction


Comments