CRREL / GRiD-API

9 stars 3 forks source link

API V2 Ticket #9

Closed trevorskaggs closed 7 years ago

trevorskaggs commented 8 years ago

Add collection information to API AOI detail call:

jyutzler commented 8 years ago

See #10 for my proposal

chambbj commented 7 years ago

@AlexMountain @trevorskaggs This comment will be in flux while I document my findings. Hopefully you will find it useful once I'm done poking and prodding.

Also, note that even when I say we should update the docs to match what's been implemented, I'm generally making these changes in the Swagger branch that I'm writing. So, no need to continue update the rst files. As long as everything I'm finding seems to be responding the way you'd expect.

Tested on TE with my API key substituted for {{source}}. The WKT polygon

POLYGON ((62.1873999999999967 34.3468000000000018, 62.1873999999999967 34.3451999999999984, 62.1901000000000010 34.3451999999999984, 62.1901000000000010 34.3468000000000018, 62.1873999999999967 34.3468000000000018))

is substituded for {{geom}}. Various :pk values were selected from my own resources.

{
    "error": "Please only provide point cloud product pks. I don't know what to do with rasters."
}
{
    "error": "Please only provide raster product pks. I don't know what to do with point clouds."
}
chambbj commented 7 years ago
chambbj commented 7 years ago
chambbj commented 7 years ago
chambbj commented 7 years ago

When generating a raster export of mixed datatype, does it really make sense to return the different datatypes in a comma-separated string? There is no mapping between this and the exportfiles, but it seems like useful information (e.g., QTM loads elevation models differently than imagery). I think that datatype maybe should be returned with each exportfile.

chambbj commented 7 years ago

@AlexMountain Tell me if you think this is still doable for v2.

In short, we need better error handling. The docs state that we get status code 200 for successful API calls, 400 for bad requests (client-side), and 500 for server-side issues.

But this rule is generally not followed. For example, you do provide an error message when source is missing from a request, but the status is still 200. It should be 400. In other places (e.g., pk other than number, pk out of range), the error message is still not used, and we get the status of 200 along with HTML in the response body.

There are almost certainly others - these are just the ones I tested. Basically any time you want to return that HTML with the title Server Error – GRiD, instead give me an error message (in JSON) with the appropriate 400/500 status code.

chambbj commented 7 years ago

@AlexMountain I think we can merge this now. Don't you think?

trevorskaggs commented 7 years ago

Resolved by https://github.com/CRREL/GRiD/commit/9626710d2d51032cbaf36b808fd78e31b70a4982