Building HTTP Get Queries

HTTP GET Syntax

HTTP GET structure is useful for building a direct query to the web service without filling out the form

The general format of an HTTP GET query is:

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

The URL to the KOA Data Access Service search executable is:

https://koa.ipac.caltech.edu/cgi-bin/KOA/nph-KOA

The following sections describes an example and possible keyword=value pairs, which are analogous to the search fields on the KOA search form.

Examples:

The following are sample parameter strings, which would be appended to the executable in the following manner:

https://koa.ipac.caltech.edu/cgi-bin/KOA/nph-KOA?parameter_string

If no instruments are specified, all instruments are searched. Retrieve all data taken between October 5th and Ocober 7th, 2010 without performing calibration association:

filetype=both&daterange=20101005-20101007

If no modes are specified, then all modes are assumed. Retrieve all science observations for HIRES (all modes) taken between August 18th and 19th, 2004, without performing calibration association:

instrument_hi=hires&filetype=science&daterange=20040818-20040819

Retrieve all science observations for HIRES (all modes) and NIRSPEC (all modes) with "m13" in the TARGNAME keyword, and also any associated calibration files:

instrument_hi=hires&instrument_ns=nirspec&filetype=science&calibassoc=assoc&spt_obj=objname&targname=m13

Retrieve all science and calibration observations for NIRSPEC (high-dispersion mode only) taken on January 3, 2007 without performing calibration association:

instrument_ns=nirspec&mode_ns2=high-dispersion&filetype=both&daterange=20070103

Retrieve all science observations for NIRC2 (wide-imaging mode only) taken on May 17, 2009, and also any associated calibration files:

instrument_n2=nirc2&mode_n23=wide-imaging&filetype=science&calibassoc=assoc&daterange=20090517

Instrument Parameters

If you don't want an all instrument search, you must specify at least one instrument. Additionally, if you don't want all modes for that instrument, you need to add relevant mode parameters for that instrument.

DEIMOS: (no modes)

instrument_de=deimos

ESI: (no modes)

instrument_es=esi

HIRES:

instrument_hi=hires

HIRES modes:

mode_hi1=iodine-in
mode_hi2=iodine-out

KCWI: (no modes)

instrument_kc=kcwi

LRIS:

instrument_lr=lris

LRIS modes:

mode_lr1=blue
mode_lr2=red
mode_lr3=imaging
mode_lr4=spectroscopy

LWS: (no modes)

instrument_lw=lws

MOSFIRE: (no modes)

instrument_mf=mosfire

NIRC: (no modes)

instrument_n1=nirc

NIRC2:

instrument_n2=nirc2

NIRC2 modes:

mode_n21=narrow-imaging
mode_n22=medium-imaging
mode_n23=wide-imaging
mode_n24=spectroscopy

NIRSPEC:

instrument_ns=nirspec

NIRSPEC modes:

mode_ns1=low-dispersion
mode_ns2=high-dispersion
mode_ns3=imaging

OSIRIS:

instrument_os=osiris

OSIRIS modes:

mode_os1=imaging
mode_os2=spectroscopy

File Type Parameters

You must specify a filetype as described below.

Science files:

To search for all science files matching the input parameters, set the file type as:

filetype=science

If filetype is set to science, there is an additional keyword/value pair that can be included to search for calibration files that are associated with the science files returned:

calibassoc=assoc

Calibration files:

To search for all calibration files matching the input parameters, set the file type as:

filetype=calib

By default, this will search for all types of calibration files. If you'd prefer to narrow your search to particular calibration types (done via checkboxes on the search page), you can include any of the following keyword/value pairs:

  • calibtype1=arclamp
  • calibtype2=bias
  • calibtype3=contbars
  • calibtype4=dark
  • calibtype5=fcscal
  • calibtype6=flatlamp
  • calibtype7=flatlampoff
  • calibtype8=focus
  • calibtype9=fpc
  • calibtype10=polcal
  • calibtype11=trace
  • calibtype12=undefined

Any files:

To return all files matching the input parameters, both science and calibration (without running the calibration-association on the science files), use:

filetype=both

 

Search Criteria Parameters

Your GET query must include at least one of the following:

Spatial Search:

Set the spt_obj flag to "spatial":

spt_obj=spatial

Supply a coordinate string or object name to resolve, as well as a search radius and units (one of deg, arcmin, arcsec):

locstr=location
regSize=radius
radunits=deg|arcmin|arcsec (arcsec is the default)

Choose the resolver to attempt first, NED or SIMBAD:

resolver=ned|simbad (ned is the default)

TARGNAME Keyword Search:

Set the spt_obj flag to "objname":

spt_obj=objname

Provide a "target name" string:

targname=object

UT Observation Date(s):

Provide a date string:

daterange=date_string

Note that your date string must be properly URL-encoded. For instance, "08/19/2004" must be written as 08%2F19%2F2004. Simple date strings such as "20040819-20041101" do not require any special encoding.

UT Observation Time(s):

Provide a time string:

timerange=time_string

Time strings must be URL-encoded if they include colons [:]; for instsance, "08:30" must be written as "08%3A30"

Exposure Time:

To search by exposure time:

exptime=exptime_string

exptime_string can be a single value, a range, or an expression like "> 300". If special symbols are used, they must be URL-encoded:

  • > (%3E)
  • < (%3C)
  • = (%3D)

Program Information:

To search by Program ID (progid), Semester, Program PI (progpi) or Program Title (progtitl):

progid=progid_string
semester=semester_string
progpi=progpi_string
progtitl=progtitl_string

Note: if including any spaces or special characters, they must be URL-encoded.

Frame Number(s):

The frame number search string can be complex, including several constraints separated by commas. Make sure to URL-encode any special characters and spaces:

frameno=frameno_string

KOAID:

To search by KOAID (filename):

koaid=koaid_string

Wavelength Covered: (Available only for HIRES, LRIS, NIRC2, NIRSPEC, and OSIRIS)

Provide a single wavelength value, or a range of wavelength values (WL1-WL2):

wavelengthrange=wavelength_string
wavelengthunits=angstroms|microns (angstroms is the default)

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