Skip to content

Commit ec8864b

Browse files
Documentation for SPICE queries (#3005)
* added spice documentation * replaced dev api endoints in docs with prod api endoints * Update docs/source/data-access/openapi.yml --------- Co-authored-by: Tim Plummer <timothy.plummer@lasp.colorado.edu>
1 parent 6ce6ce3 commit ec8864b

3 files changed

Lines changed: 406 additions & 8 deletions

File tree

docs/source/data-access/index.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ interacting with the API programmatically. It is the preferred way to use the AP
1111
:maxdepth: 1
1212

1313
imap-data-access
14+
spice-files
1415

1516
Users may also download, upload, and query via the REST API directly through the browser, or via `curl` commands.
1617
The `REST API Specification`_ section describes the various endpoints that are supported, and how to use them.
1718

1819
*Note: Several sections and links begin with* [WIP]. *As development on the API is ongoing, this indicates
1920
that the full implementation of the functionality is yet to be completed.*
2021

21-
The API can be accessed from the following URL [WIP]: https://api.dev.imap-mission.com
22+
The API can be accessed from the following URL [WIP]: https://api.imap-mission.com
2223

2324
Command Line Utility
2425
--------------------
@@ -162,7 +163,7 @@ for example, with ``IMAP_DATA_DIR=/data:``
162163
Data Access URL
163164
^^^^^^^^^^^^^^^
164165

165-
To change the default URL that the package accesses, you can set the environment variable ``IMAP_DATA_ACCESS_URL`` or within the package ``imap_data_access.config["DATA_ACCESS_URL"]``. The default is the development server (``https://api.dev.imap-mission.com``).
166+
To change the default URL that the package accesses, you can set the environment variable ``IMAP_DATA_ACCESS_URL`` or within the package ``imap_data_access.config["DATA_ACCESS_URL"]``. The default is the production server (``https://api.imap-mission.com``).
166167

167168
File Validation
168169
---------------
@@ -227,7 +228,7 @@ REST API Specification
227228

228229
.. code-block:: bash
229230
230-
curl -X GET -H "Accept: application/json" https://api.dev.imap-mission.com/upload/imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_20240105_v00-01.pkts
231+
curl -X GET -H "Accept: application/json" https://api.imap-mission.com/upload/imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_20240105_v00-01.pkts
231232
232233
**Possible Responses:**
233234

@@ -252,7 +253,7 @@ REST API Specification
252253

253254
.. code-block:: bash
254255
255-
curl -X GET -H "Accept: application/json" https://api.dev.imap-mission.com/download/imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_20240105_v00-01.pkts
256+
curl -X GET -H "Accept: application/json" https://api.imap-mission.com/download/imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_20240105_v00-01.pkts
256257
257258
**Possible Responses:**
258259

@@ -270,7 +271,7 @@ REST API Specification
270271

271272
.. code-block:: bash
272273
273-
curl -X GET -H "Accept: application/json" https://api.dev.imap-mission.com/query?instrument=swe&data_level=l0&descriptor=sci&start_date=20240105&end_date=20240105&extension=pkts
274+
curl -X GET -H "Accept: application/json" https://api.imap-mission.com/query?instrument=swe&data_level=l0&descriptor=sci&start_date=20240105&end_date=20240105&extension=pkts
274275
275276
**Possible Responses:**
276277

docs/source/data-access/openapi.yml

Lines changed: 180 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.0.0
22
servers:
3-
- description: Development IMAP SDC Server
4-
host: https://api.dev.imap-mission.com/
3+
- description: Production IMAP SDC Server
4+
host: https://api.imap-mission.com/
55
info:
66
version: "0.1.0"
77
title: IMAP SDC API
@@ -229,4 +229,181 @@ paths:
229229
type: array
230230
items:
231231
type: string
232-
format: uri
232+
format: uri
233+
234+
'/spice-query':
235+
get:
236+
tags:
237+
- SPICE Query
238+
summary: Query for SPICE kernel metadata
239+
operationId: spice-query
240+
parameters:
241+
- in: query
242+
name: file_name
243+
description: |
244+
The name of a specific SPICE kernel file (e.g. ``naif0012.tls``).
245+
required: false
246+
schema:
247+
type: string
248+
- in: query
249+
name: start_time
250+
description: |
251+
Coverage start time in TDB seconds since J2000. Returns kernels whose
252+
coverage ends on or after this time.
253+
required: false
254+
schema:
255+
type: string
256+
- in: query
257+
name: end_time
258+
description: |
259+
Coverage end time in TDB seconds since J2000. Returns kernels whose
260+
coverage begins on or before this time.
261+
required: false
262+
schema:
263+
type: string
264+
- in: query
265+
name: type
266+
description: |
267+
The SPICE kernel type to filter by. Accepted values are:
268+
``leapseconds``, ``planetary_constants``, ``imap_frames``,
269+
``science_frames``, ``spacecraft_clock``, ``earth_attitude``,
270+
``planetary_ephemeris``, ``ephemeris_reconstructed``,
271+
``ephemeris_nominal``, ``ephemeris_predicted``, ``ephemeris_90days``,
272+
``ephemeris_long``, ``ephemeris_launch``, ``attitude_history``,
273+
``attitude_predict``, ``pointing_attitude``.
274+
required: false
275+
schema:
276+
type: string
277+
- in: query
278+
name: latest
279+
description: |
280+
If ``True``, only return the latest version of each kernel matching
281+
the other query parameters.
282+
required: false
283+
schema:
284+
type: string
285+
- in: query
286+
name: start_ingest_date
287+
description: |
288+
Filter results to kernels ingested on or after this date, in the
289+
format ``YYYYMMDD``.
290+
required: false
291+
schema:
292+
type: string
293+
- in: query
294+
name: end_ingest_date
295+
description: |
296+
Filter results to kernels ingested on or before this date, in the
297+
format ``YYYYMMDD``.
298+
required: false
299+
schema:
300+
type: string
301+
responses:
302+
'200':
303+
description: Successful query — returns a list of SPICE kernel metadata objects
304+
content:
305+
application/json:
306+
schema:
307+
type: array
308+
items:
309+
type: object
310+
'400':
311+
description: Invalid query parameter or parameter value
312+
content:
313+
application/json:
314+
schema:
315+
type: string
316+
317+
'/metakernel':
318+
get:
319+
tags:
320+
- SPICE Query
321+
summary: Retrieve a metakernel or list of SPICE kernel filenames for a time range
322+
operationId: metakernel
323+
parameters:
324+
- in: query
325+
name: start_time
326+
description: |
327+
Coverage start time. Accepts either TDB seconds since J2000 or a date
328+
string in the format ``YYYYMMDD``.
329+
required: true
330+
schema:
331+
type: string
332+
- in: query
333+
name: end_time
334+
description: |
335+
Coverage end time. Accepts either TDB seconds since J2000 or a date
336+
string in the format ``YYYYMMDD``.
337+
required: true
338+
schema:
339+
type: string
340+
- in: query
341+
name: spice_path
342+
description: |
343+
Root path for the SPICE directory. This path is prepended to all kernel file
344+
locations in the returned metakernel. If omitted the paths are left
345+
relative. Only applicable if ``list_files``` is ``False``.
346+
required: false
347+
schema:
348+
type: string
349+
- in: query
350+
name: list_files
351+
description: |
352+
If ``True``, return only a list of kernel filenames instead of a full
353+
metakernel file.
354+
required: false
355+
schema:
356+
type: string
357+
- in: query
358+
name: require_coverage
359+
description: |
360+
If ``True``, the request will fail with a HTTP ``422`` status if there
361+
are any gaps in coverage for the requested time range.
362+
required: false
363+
schema:
364+
type: string
365+
- in: query
366+
name: file_types
367+
description: |
368+
Comma-separated list of kernel types to include. If omitted, all
369+
available kernel types are included. Accepted values are:
370+
``leapseconds``, ``planetary_constants``, ``imap_frames``,
371+
``science_frames``, ``spacecraft_clock``, ``earth_attitude``,
372+
``planetary_ephemeris``, ``ephemeris_reconstructed``,
373+
``ephemeris_nominal``, ``ephemeris_predicted``, ``ephemeris_90days``,
374+
``ephemeris_long``, ``ephemeris_launch``, ``attitude_history``,
375+
``attitude_predict``, ``pointing_attitude``.
376+
required: false
377+
schema:
378+
type: string
379+
responses:
380+
'200':
381+
description: |
382+
Successful response. Returns a metakernel file (text/plain) when
383+
``list_files`` is ``False`` (default), or a JSON array of kernel
384+
filenames when ``list_files`` is ``True``.
385+
content:
386+
text/plain:
387+
schema:
388+
type: string
389+
application/json:
390+
schema:
391+
type: array
392+
items:
393+
type: string
394+
'404':
395+
description: No kernel files found for the requested time range
396+
content:
397+
application/json:
398+
schema:
399+
type: string
400+
'422':
401+
description: |
402+
Coverage gaps detected when ``require_coverage=True``. The response
403+
body contains a list of the gap intervals.
404+
content:
405+
application/json:
406+
schema:
407+
type: array
408+
items:
409+
type: object

0 commit comments

Comments
 (0)