Skip to content

Commit cdb3230

Browse files
authored
Replace id, time.min, time.max
Added API changes section and links to it.
1 parent 985c562 commit cdb3230

File tree

1 file changed

+56
-55
lines changed

1 file changed

+56
-55
lines changed

hapi-dev/HAPI-data-access-spec-dev.md

+56-55
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Version 3.0.0-dev \| Heliophysics Data and Model Consortium (HDMC) \|
55

66
**This is the development version of the HAPI Data Access Specification.**
77

8-
The most recent stable release is [Version 2.1.0](https://github.com/hapi-server/data-specification/tree/master/hapi-2.1.0).
8+
The most recent stable release is [Version 2.1.1](https://github.com/hapi-server/data-specification/tree/master/hapi-2.1.1).
99

1010
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1111
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -43,6 +43,17 @@ Table of Contents
4343

4444
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
4545

46+
Major API Changes
47+
============
48+
49+
HAPI 3.0 is backward-compatable except
50+
51+
In HAPI 3.0,
52+
1. the URL parameter `id` was replaced with `dataset`.
53+
2. `time.min` and `time.max` were replaced with `start` and `stop`, respectively.
54+
55+
HAPI 3.X servers must accept both parameter names, but HAPI 2.X servers will respond with an error if the new URL parameter names are used. These changes were discussed in issue [#77](https://github.com/hapi-server/data-specification/issues/77).
56+
4657

4758
Introduction
4859
============
@@ -96,12 +107,12 @@ while hiding actual storage details.
96107
**request parameter** – keywords that appear after the ‘?’ in a URL with a GET
97108
request.
98109

99-
Consider this example GET request:
110+
Consider this example GET request [<sup>*</sup>](#major-api-changes):
100111
```
101-
http://server/hapi/data?id=alpha&time.min=2016-07-13
112+
http://server/hapi/data?dataset=alpha&start=2016-07-13&stop=2016-07-14
102113
```
103114

104-
The two request parameters are `id` (corresponding to the identifier of the dataset) and `time.min`. They
115+
The two request parameters are `dataset` (corresponding to the identifier of the dataset) and `start`. They
105116
have values of `alpha` and `2016-07-13` respectively. This document will always
106117
use the full phrase "request parameter" to refer to these URL elements to draw a
107118
clear distinction from a parameter in a dataset.
@@ -115,7 +126,7 @@ The HAPI specification consists of five required endpoints that give clients a
115126
precise way to first determine the data holdings of the server and then to
116127
request data from the server. The functionality of the required endpoints is as follows:
117128

118-
1. `/hapi/capabilities` lists the output formats the server can emit (`csv`, `binary`, or `json`, described below).
129+
1. `/hapi/capabilities` lists the output formats the server can emit (`csv`, `binary`, or `json`, [described below](#data-stream-content)).
119130

120131
2. `/hapi/about` lists the server id and title, contact information, and a brief description of the datsets served (new in 3.0 HAPI specification).
121132

@@ -140,8 +151,8 @@ http://server/hapi (Optional HTML landing page)
140151
http://server/hapi/capabilities
141152
http://server/hapi/about
142153
http://server/hapi/catalog
143-
http://server/hapi/info?id=...[&...]
144-
http://server/hapi/data?id=...&...
154+
http://server/hapi/info?dataset=...[&...]
155+
http://server/hapi/data?dataset=...&...
145156
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146157

147158
All requests to a HAPI server are for retrieving resources and must not change
@@ -272,7 +283,7 @@ A server must support `csv` output format, but `binary` output format and `json`
272283
output may optionally be supported. Servers may support custom output formats,
273284
which would be advertised here. All custom formats listed by a server must begin
274285
with the string `x_` to indicate that they are custom formats and avoid
275-
collisions with possible future additions to the specification.
286+
naming conflicts with possible future additions to the specification.
276287

277288
**Sample Invocation**
278289

@@ -446,14 +457,14 @@ data are all within a single JSON entity, and so newlines are not necessary.
446457
**Sample Invocation**
447458

448459
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
449-
http://server/hapi/info?id=ACE_MAG
460+
http://server/hapi/info?dataset=ACE_MAG
450461
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
451462

452463
**Request Parameters**
453464

454465
| Name | Description |
455466
|------------|-------------------------------------------------------------------|
456-
| id | **Required** The identifier for the dataset. |
467+
| dataset | **Required** The identifier for the dataset[<sup>*</sup>](#major-api-changes) |
457468
| parameters | **Optional** A subset of the parameters to include in the header. |
458469

459470
**Response**
@@ -529,12 +540,10 @@ ranges = [[1,3], null, [3,5]]
529540
```
530541
A future release is expected to support time varying bins and the use of null `centers` or `ranges`.
531542

532-
533-
534543
**Example**
535544

536545
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
537-
http://server/hapi/info?id=ACE_MAG
546+
http://server/hapi/info?dataset=ACE_MAG
538547
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
539548

540549
**Example Response:**
@@ -657,9 +666,6 @@ Here are some example fragments from a parameter definition showing what is allo
657666
"label": [["V1x","V1y","V1z"],["V2x","V2y","V2z"]]
658667
```
659668

660-
661-
662-
663669
**Subsetting the Parameters**
664670

665671
Clients may request a response that includes only a subset of the parameters in
@@ -673,37 +679,37 @@ of dataset parameter subsetting requests:
673679

674680
- **request:** do not ask for any specific parameters (i.e., there is no request
675681
parameter called ‘parameters’);
676-
**example:** `http://server/hapi/data?id=MY_MAG_DATA&time.min=1999Z&time.max=2000Z`
682+
**example:** `http://server/hapi/data?dataset=MY_MAG_DATA&start=1999Z&stop=2000Z`
677683
**response:** all columns
678684

679685
- **request:** ask for just the primary time parameter;
680-
**example:** `http://server/hapi/data?id=MY_MAG_DATA&parameters=Epoch&time.min=1999Z&time.max=2000Z`
686+
**example:** `http://server/hapi/data?dataset=MY_MAG_DATA&parameters=Epoch&start=1999Z&stop=2000Z`
681687
**response:** just the primary time column
682688

683689
- **request:** ask for a single parameter other than the primary time column (like ‘parameters=Bx’);
684-
**example:** `http://server/hapi/data?id=MY_MAG_DATA&parameters=Bx&time.min=1999Z&time.max=2000Z`
690+
**example:** `http://server/hapi/data?dataset=MY_MAG_DATA&parameters=Bx&start=1999Z&stop=2000Z`
685691
**response:** primary time column and the one requested data column
686692

687693
- **request:** ask for two or more parameters other than the primary time column;
688-
**example:** `http://server/hapi/data?id=MY_MAG_DATA&parameters=Bx,By&time.min=1999Z&time.max=2000Z`
694+
**example:** `http://server/hapi/data?dataset=MY_MAG_DATA&parameters=Bx,By&start=1999Z&stop=2000Z`
689695
**response:** primary time column followed by the requested parameters in the
690696
order they occurred in the original, non-subsetted dataset header (not in
691697
the order of the subset request)
692698

693699
- **request:** including the `parameters` option, but not specifying any parameter names;
694-
**example:** `http://server/hapi/data?id=MY_MAG_DATA&parameters=&time.min=1999Z&time.max=2000Z`
700+
**example:** `http://server/hapi/data?dataset=MY_MAG_DATA&parameters=&start=1999Z&stop=2000Z`
695701
**response:** the is an error condition; server should report a user input error
696702

697703
Note that the order in which parameters are listed in the request must not differ from the order that
698704
they appear in the response. For a data set with parameters `Time,param1,param2,param3` this subset
699705
request
700706

701-
`?id=ID&parameters=Time,param1,param3`
707+
`?dataset=ID&parameters=Time,param1,param3`
702708

703709
is OK, becasue `param1` is before `param3` in the `parameters` array (as determined by the `/info`
704710
response). However, asking for a subset of parameters in a different order, as in
705711

706-
`?id=ID&parameters=Time,param3,param1`
712+
`?dataset=ID&parameters=Time,param3,param1`
707713

708714
is not allowed, and servers must respond with an error status.
709715
See [HAPI Status Codes](#hapi-status-codes) for more about error conditions and codes.
@@ -726,9 +732,9 @@ parameter.
726732

727733
| Name | Description |
728734
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
729-
| id | **Required** The identifier for the dataset. |
730-
| time.min | **Required** The inclusive begin time for the data to include in the response. |
731-
| time.max | **Required** The exclusive end time for the data to include in the response. |
735+
| dataset[<sup>*</sup>](#major-api-changes) | **Required** The identifier for the dataset. |
736+
| start[<sup>*</sup>](#major-api-changes) | **Required** The inclusive begin time for the data to include in the response. |
737+
| stop[<sup>*</sup>](#major-api-changes) | **Required** The exclusive end time for the data to include in the response. |
732738
| parameters | **Optional** A comma-separated list of parameters to include in the response. Default is all parameters. |
733739
| include | **Optional** Has one possible value of "header" to indicate that the info header should precede the data. The header lines will be prefixed with the "\#" character. |
734740
| format | **Optional** The desired format for the data stream. Possible values are "csv", "binary", and "json". |
@@ -756,8 +762,8 @@ The first parameter in the data must be a time column (type of "isotime") and
756762
this must be the independent variable for the dataset. If a subset of parameters
757763
is requested, the time column is always provided, even if it is not requested.
758764

759-
Note that the `time.min` request parameter represents an inclusive lower bound
760-
and `time.max` request parameter is the exclusive upper bound. The server must
765+
Note that the `start` request parameter represents an inclusive lower bound
766+
and `stop` request parameter is the exclusive upper bound. The server must
761767
return data records within these time constraints, i.e., no extra records
762768
outside the requested time range. This enables concatenation of results from
763769
adjacent time ranges.
@@ -784,12 +790,12 @@ contain fewer parameters, but must not rearrange the order of any parameters.
784790
Duplicates are not allowed.
785791

786792
Consider the following dataset header for a fictional dataset with
787-
the identifier MY\_MAG\_DATA.
793+
the identifier `MY_MAG_DATA`.
788794

789-
An `info` request for this dataset
795+
An `info` request for this dataset[<sup>*</sup>](#major-api-changes)
790796

791797
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
792-
http://server/hapi/info?id=MY_MAG_DATA
798+
http://server/hapi/info?dataset=MY_MAG_DATA
793799
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
794800

795801
results in a header listing of all the dataset parameters:
@@ -812,10 +818,10 @@ results in a header listing of all the dataset parameters:
812818
}
813819
```
814820

815-
An `info` request for a single parameter looks like this
821+
An `info` request for a single parameter looks like this[<sup>*</sup>](#major-api-changes)
816822

817823
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
818-
http://server/hapi/info?id=MY_MAG_DATA&parameters=Bx
824+
http://server/hapi/info?dataset=MY_MAG_DATA&parameters=Bx
819825
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
820826

821827
and would result in the following header:
@@ -838,17 +844,13 @@ and would result in the following header:
838844

839845
Note that the time parameter is included even though it was not requested.
840846

841-
842-
In this request
847+
In this request[<sup>*</sup>](#major-api-changes)
843848
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
844-
http://server/hapi/info?id=MY_MAG_DATA&parameters=By,Bx
849+
http://server/hapi/info?dataset=MY_MAG_DATA&parameters=By,Bx
845850
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
846851
the parameters are out of order. So the server should respond with an error code.
847852
See [HAPI Status Codes](#hapi-status-codes) for more about error conditions.
848853

849-
850-
851-
852854
### Data Stream Content
853855

854856
The three possible output formats are `csv`, `binary`, and `json`. A HAPI server
@@ -893,7 +895,6 @@ many bytes to read for each string value. If the string content is less than
893895
the length, the remaining bytes must be padded with ASCII null bytes. If a string
894896
uses all the bytes specified in the length, no null terminator or padding is needed.
895897

896-
897898
**JSON Output**
898899

899900
For the JSON output, an additional `data` element added to the header contains
@@ -994,7 +995,7 @@ header from the `info` endpoint will be prepended to the data but with a ‘\#
994995
character as a prefix for every header line.
995996

996997
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
997-
http://server/hapi/data?id=path/to/ACE_MAG&time.min=2016-01-01Z&time.max=2016-02-01Z&include=header
998+
http://server/hapi/data?dataset=path/to/ACE_MAG&start=2016-01-01Z&stop=2016-02-01Z&include=header
998999
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9991000

10001001
**Example Response: Data with Header**
@@ -1047,7 +1048,7 @@ The following example is the same, except it lacks the request to include the
10471048
header.
10481049

10491050
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1050-
http://server/hapi/data?id=path/to/ACE_MAG&time.min=2016-01-01&time.max=2016-02-01
1051+
http://server/hapi/data?dataset=path/to/ACE_MAG&start=2016-01-01&stop=2016-02-01
10511052
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10521053

10531054
**Example Response: Data Only**
@@ -1290,7 +1291,7 @@ Incoming time values
12901291
--------------------
12911292

12921293
Servers must require incoming time values from clients (i.e.,
1293-
the `time.min` and `time.max` values on a data request) to be
1294+
the `start` and `stop` values on a data request) to be
12941295
valid ISO 8601 time values.
12951296
The full ISO 8601 specification allows many esoteric options, but servers must only
12961297
accept a subset of the full ISO 8601 specification,
@@ -1311,9 +1312,9 @@ fields missing.
13111312

13121313
| Example time range request | comments |
13131314
|------------------------------|------------------------------------------------|
1314-
| `time.min=2017-01-15T00:00:00.000Z&time.max=2017-01-16T00:00.000Z` | OK - fully specified time value with proper trailing Z |
1315-
| `time.min=2017-01-15Z&time.max=2017-01-16Z` | OK - truncated time value that assumes 00:00.000 for the time |
1316-
| `time.min=2017-01-15&time.max=2017-01-16` | OK - truncated with missing trailing Z, but GMT+0 should be assumed |
1315+
| `start=2017-01-15T00:00:00.000Z&stop=2017-01-16T00:00.000Z` | OK - fully specified time value with proper trailing Z |
1316+
| `start=2017-01-15Z&stop=2017-01-16Z` | OK - truncated time value that assumes 00:00.000 for the time |
1317+
| `start=2017-01-15&stop=2017-01-16` | OK - truncated with missing trailing Z, but GMT+0 should be assumed |
13171318

13181319
There is no restriction on the earliest date or latest date a HAPI server can accept, but as
13191320
a practical limit, clients are likely to be written to handle dates only in the range from
@@ -1337,10 +1338,10 @@ with the `length` attribute for the time parameter, which refers to the number o
13371338
characters in the string. Every time string must have the same length and so padding of time strings is not needed.
13381339

13391340
The data returned from a request should strictly fall within the limits of
1340-
`time.min` and `time.max`, i.e., servers should not pad the data with extra
1341-
records outside the requested time range. Furthermore, note that the `time.min`
1341+
`start` and `stop`, i.e., servers should not pad the data with extra
1342+
records outside the requested time range. Furthermore, note that the `start`
13421343
value is inclusive (data at or beyond this time can be included), while
1343-
`time.max` is exclusive (data at or beyond this time shall not be included in
1344+
`stop` is exclusive (data at or beyond this time shall not be included in
13441345
the response).
13451346

13461347
The primary time column is not allowed to contain any fill values. Each record
@@ -1498,7 +1499,7 @@ requested from a server. The first example, by listing Bx, By, and Bz as
14981499
separate parameters, allows clients to request individual components:
14991500

15001501
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1501-
http://server/hapi/data?id=MY_MAG_DATA&time.min=2001Z&time.max=2010Z&parameters=Bx
1502+
http://server/hapi/data?dataset=MY_MAG_DATA&start=2001Z&stop=2010Z&parameters=Bx
15021503
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15031504

15041505
This request would just return a time column (always included as the first
@@ -1615,7 +1616,7 @@ throw an error.
16151616
So given this query
16161617
16171618
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1618-
http://server/hapi/data?id=DATA&time.min=T1&time.max=T2&fields=mag_GSE&avg=5s
1619+
http://server/hapi/data?dataset=DATA&start=T1&stop=T2&fields=mag_GSE&avg=5s
16191620
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16201621
16211622
the server should throw an error with a status of "1400 - Bad Request" with an HTTP
@@ -1681,7 +1682,7 @@ Appendix A: Sample Landing Page
16811682
<li> <a href="capabilities">capabilities</a> describe the capabilities of the server; this lists the output formats the server can emit (CSV and binary)</li>
16821683
<li><a href="catalog">catalog</a> list the datasets that are available; each dataset is associated with a unique id</li>
16831684
<li><a href="info">info</a> obtain a description for dataset of a given id; the description defines the parameters in every dataset record</li>
1684-
<li><a href="data">data</a> stream data content for a dataset of a given id; the streaming request must have time bounds (specified by request parameters time.min and time.max) and may indicate a subset of parameters (default is all parameters)</li>
1685+
<li><a href="data">data</a> stream data content for a dataset of a given id; the streaming request must have time bounds (specified by request parameters <code>start</code> and <code>stop</code>) and may indicate a subset of parameters (default is all parameters)</li>
16851686
</ol>
16861687
<p> For more information, see <a href="http://spase-group.org/hapi">this HAPI description</a> at the SPASE web site. </p>
16871688
</body>
@@ -1697,9 +1698,9 @@ Appendix B: JSON Object of HAPI Response and Error Codes
16971698
"1201": {"status":{"code": 1201, "message": "HAPI 1201: OK - no data"}},
16981699
"1400": {"status":{"code": 1400, "message": "HAPI error 1400: user input error"}},
16991700
"1401": {"status":{"code": 1401, "message": "HAPI error 1401: unknown API parameter name"}},
1700-
"1402": {"status":{"code": 1402, "message": "HAPI error 1402: error in time.min"}},
1701-
"1403": {"status":{"code": 1403, "message": "HAPI error 1403: error in time.max"}},
1702-
"1404": {"status":{"code": 1404, "message": "HAPI error 1404: time.min equal to or after time.max"}},
1701+
"1402": {"status":{"code": 1402, "message": "HAPI error 1402: error in start"}},
1702+
"1403": {"status":{"code": 1403, "message": "HAPI error 1403: error in stop"}},
1703+
"1404": {"status":{"code": 1404, "message": "HAPI error 1404: start equal to or after stop"}},
17031704
"1405": {"status":{"code": 1405, "message": "HAPI error 1405: time outside valid range"}},
17041705
"1406": {"status":{"code": 1406, "message": "HAPI error 1406: unknown dataset id"}},
17051706
"1407": {"status":{"code": 1407, "message": "HAPI error 1407: unknown dataset parameter"}},

0 commit comments

Comments
 (0)