-
Notifications
You must be signed in to change notification settings - Fork 2
Home
For a request that results in a HAPI 14xx error, the server should ideally respond with an HTTP header with a first line of, e.g.,
HTTP/1.1 400 HAPI error 1406: unknown dataset id
(This message is what is recommended in the spec.)
instead of the typical default of
HTTP/1.1 400 Bad Request
The motivation for this is that some HTTP clients will not return the response body when the request resulted in a 400 response (for a 400 response, a HAPI server must respond with a body that contains a HAPI JSON object with a HAPI error code which contains more specifics about why the request was invalid). If the client does not have access to the response body, they may be able to determine the HAPI error code by inspecting the HTTP headers if they are available.
The verifier makes two types of data requests.
A request with a time range that spans 1 millisecond and starts at start
given in the request URL using, in order of priority, start
given in the URL, sampleStartDate
(if found in /info
response), or startDate
. The verifier expects the server to return no data and wants the optional HAPI 1201
(see below) in the HTTP status message.
If the verifier's expectations are not met for a request of type 1., a warning is generated. It is possible for the warning to be generated erroneously if data are available in the 1 ms time range used for the request; in this case, it can be ignored (but note that a test for a 1201
response will not have been made).
For a request that results in a HAPI 1201
status (corresponding to no data in the requested time range), the server should ideally respond with an HTTP status header with a first line of
HTTP/1.1 200 HAPI 1201: OK - no data
(This message is what is recommended in the spec.)
Most HTTP servers will respond with the default of
HTTP/1.1 200 OK
If possible, the server should modify the message that follows the status code 200 from OK
to HAPI 1201: OK - no data
. The motivation is that if a data request is made for which there are no data in the requested time range, by default, the body of the response from a HAPI server must be empty (unless include=header
was specified); the existence of 1201
in the HTTP header allows the client to confirm that the empty body is due to no data being in the requested time range as opposed to a server problem.
A request with a time range from start
to stop
in the request URL (if given), sampleStartDate
to sampleStopDate
(if in the /info
response), or startDate
to startDate + 1 day
. The verifier expects the server to return data (and not have HAPI 1201
in the HTTP status message).
If data are returned and HAPI 1201
appears in the HTTP status message, an error is generated.
If no data are returned, an error is generated because a data response cannot be tested. This can be fixed by either adding sampleStartDate
and sampleStopDate
to the /info
response (preferred) or modifying the verifier request URL to include a start
and stop
(when given, these will be used in place of sampleStartDate
and sampleStopDate
).