query interface¶
The query interface allows to programmatically search for products in the macsserver database. This is done by HTTP request to specially crafted URLs.
query format¶
The base url for querying is:
http://macsserver/query
After this prefix, the user can add key-value parameters in the following form:
/key[_modifier]:value
Where key
is the field to search for and value
the value to match the query.
The modifier
is optional, when ommitted, the query seraches for an exact match.
The following ``key``s are currently supported:
_oid
: object id (str)sensorId
: sensor id (str)campaign
==userMeta.campaign
: campaign id (str)intent
==userMeta.intent
: intent id (str)mountOptions
==userMeta.mountOptions
: mount option id (str)productType
: product type id (str)date
: date and time of capture (milliseconds since the epoch == JavaScript convention)
The modifiers will alter the query in the following manner:
min
: Match all attributes which are greater or equal.max
: Match all attributes which are less or equal.
Additionally, there are special keys, which are written in all uppercase. The following special keys are currently supported:
LIMIT
: Maximum number of results to return.OFS
: Number of results to skip.
The special keys LIMIT
and OFS
can be used for pagination.
So if the user wants to query for all SWIR data from ACRIDICON 2014 from 27.08.2014 00:00:00+01:00 until 01.09.2014 00:00:00+01:00, with a maximum of 90 results, starting from the beginning, the correct query would be:
http://macsserver/query/campaign:acridicon2014/sensorId:410043/date_min:1409090400000/date_max:1409522400000/LIMIT:90/OFS:0
answer from the server¶
The server will return JSON data in the following form:
{"count": NUMBER OF TOTAL RESULTS,
"result": [RES_0, RES_1, RES_2, ...]}
Where count
will always give the number of results for the query, without considering
LIMIT
or OFS
. The result
list will contain objects containing:
_oid
: object id (str)date
: date and time (ISO 8601)sensorId
: sensor id (str)userMeta
: object containing user defined metadata