SWAS Program-Line Interface

(Applications Programming Interface)

The SWAS Spectrum Server is used to query SWAS spectra data which reside at IRSA. These data can be accessed via an interactive front end, as well as via an HTTP GET/POST program interface where the request is a set of "parameter=value" pairs. The query result can be either in a HTML format or in an XML document containing URL links to the outputs.

 

The general format of an HTTP GET query is:

[URL of program]?[keyword1=value1]& [keyword2=value2]&...[keywordn=valuen]

The values of special ASCII characters such as "+" must be represented in hexadecimal URL encoding form. A complete list is available at http://www.w3schools.com/tags/ref_urlencode.asp. Some common characters are given below:

URL-encoding special characters:
Character URL encoding
Plus ("+") %2B
Comma (",") %2C
Forward slash ("/") %2F
Colon (":") %3A
Semi-colon (";") %3B
Equals ("=") %3D
Question mark ("?") %3F
Space (" ") %20
Quotation marks (") %22
Less than ("<") %3C
Greater than (">") %3E
Percent ("%") %25

 

The URL for the SWAS Spectrum server is

http://irsa.ipac.caltech.edu/cgi-bin/SWAS/SWAS/nph-swas

Parameters:

The server accepts the following keywords, which are analogous to the search fields on the SWAS web form:

Parameter Required Description
objstr Y Search location parameter.
The input can be a coordinate or an astronomical object name. An object name will be resolved by SWAS first; if the object is not recognized by SWAS, it will be resolved by NED or by SIMBAD.
radius Y Radius of a region search.
radunits Y Unit for search radius. The possible values are arcsec, arcmin, and deg.
o2_file N Return O2 spectra.
ci_file N Return CI spectra.
co_file N Return 13CO spectra.
h2o_file N Return H2O spectra.
h218o_file N Return H218O spectra.
other_file N Return data in other spectral ranges.
mode N Specify output format.
xml _____ generates output in xml.
html _____ generates output in html.

 

Examples for Generating HTML Output

(1) Region Search with SWAS object "B5", with spectra of H2O and H218O
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=b5&radius=1.0&radunits=deg&h218ofile=h218o_file&h2ofile=h2o_file

(2) Region Search with SWAS object "B5", with all available spectra.
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=b5&radius=1.0&radunits=deg

(3) Region Search with coordinate 56.92 32.85.
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=56.92+32.85&radius=1.0&radunits=deg

 

Examples for Generating XML Output

(1) Region Search with SWAS object "B5" , with spectra of H2O and H218O
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=b5&radius=1.0&radunits=deg&h218ofile=h218o_file&h2ofile=h2o_file&mode=xml

(2) Region Search with SWAS object "B5", with all possible spectra.
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=b5&radius=1.0&radunits=deg&mode=xml

(3) Region Search with coordinate 56.92 32.85.
Click to run and view the result
http://irsa.ipac.caltech.edu/cgi-bin/SWAS/nph-swas?locstr=56.92+32.85&radius=1.0&radunits=deg&mode=xml