The following contains additional information concerning the use of JSON with the SSC web services.
This document assumes that the reader is familar with the SSC web services and JSON.
The official interface to the SSC web services is defined by this page and this XML schema. This is a well defined interface and every effort is made to maintain backward compatibility in future releases. Client developers who want maximum stability should use XML to interface with the SSC web services. However, JSON is supported as an alternative. Anyone choosing to use JSON should realize that it is less stable and may change in the future. There are also some limitations and peculiarities that a client developer must be aware of. The rest of this document describes these issues and contains some working examples of using JSON with the SSC web services.
There are many detailed formatting issue with a JSON request that a client
must follow. The details generally have to do with additional typing
information that must be included in the JSON. For example, see the
[ "gov.nasa.gsfc.sscweb.schema.DataRequest, ...]"
and "java.util.ArrayList"
fields in the following JSON fragment:
[ "gov.nasa.gsfc.sscweb.schema.DataRequest", { "Description": "Complex locator request with nearly all options.", "TimeInterval": [ "gov.nasa.gsfc.sscweb.schema.TimeInterval", { "Start": [ "javax.xml.datatype.XMLGregorianCalendar", "2008-01-02T11:00:00.000+00:00" ], "End": [ "javax.xml.datatype.XMLGregorianCalendar", "2008-01-02T11:59:59.000+00:00" ] } ], "Satellites": [ "java.util.ArrayList", [ [ "gov.nasa.gsfc.sscweb.schema.SatelliteSpecification", { "Id": "themisa", "ResolutionFactor": 2 } ], ...
The easiest way to determine what a JSON request should be is to POST the
equivalent XML request to /echoDataRequest
,
/echoGraphRequest
, or /echoQueryRequest
and
request JSON for the response. For example, if you create an XML
DataRequest
in a file named dataRequest.xml
. Then
do
$ curl -H "Content-Type: application/xml" -H "Accept: application/json" \ --data-ascii @dataRequest.xml \ http://sscweb.gsfc.nasa.gov/WS/sscr/2/echoDataRequest \ | python -mjson.tool > dataRequest.json
The following section contains JSON examples of each type of SSC request. They illustrate how to use JSON to interact with the SSC web services.
The following illustrates an SSC /locations
request.
The request entity body is
and the response is
The following illustrates an SSC /graphs
request.
The request entity body is
and the response is
The following illustrates an SSC /conjuctions
request.
The request entity body is
and the response is
Questions or comments concerning these Web services should be sent to SSC Feedback.