Loris: [API] Inconsistencies in v0.0.2 endpoints cause confusion

Created on 24 Jul 2018  Â·  9Comments  Â·  Source: aces/Loris

Brought up in the LORIS meeting on July 24, 2018:

* API v0.0.2 in LORIS18 endpoint inconsistencies:
* Why some endpoints do not care about trailing slash? /login vs /login/ vs /candidate vs /candidates/: Login don't care trailing slash, Candidate one will fail in a 200 way on /candidates.
* Post (anything) to /candidates and server will just pretend Post request is Get and return list of candidates. Why? Shouldn't it give different error message?
* Post nonconforming PSCID in candidate info to /candidates will give 500. Is that the intended behaviour? Or should API return some error code instead?
* Current document suggest post to /candidate. I lost 4 days of my life on this….
* Lastly, what is preventing multisite users to create candidate via API currently?
* Using PUT to creating timepoint for subjects via API, is "subproject" the same thing as "test battery"?

TODO:

  • [ ] Endpoints should be normalized to require ending-slashes and add them on behalf of the user if they are missing.

  • [ ] More specific status codes should be given, i.e. a 400 Bad Request in the example above

Note: Some of these issues may be addressed in v0.0.3dev. Could someone else comment on this?

API Bug

Most helpful comment

@johnsaigle

Why some endpoints do not care about trailing slash? /login vs /login/ vs /candidate vs /candidates/: Login don't care trailing slash, Candidate one will fail in a 200 way on /candidates.

This is due to apache that refuse to serve directories as endpoints. Under api/v.../ the is a projects directory and a candidates directory. This is why you nee to add a / at the end sur the rewrite rules catches it.
The transfer of endpoints in the api modules will allow for /projects and /candidates to work.

All 9 comments

Point 2 and Point 3 additional details:

Above regarding: /candidates/ vs /candidate and the POST request result in GET like response at wrong endpoint.

img_0932

Point 4 Additional Details: regarding 500 error when PSCID does not conforming to project specification.

file

Point 6 Additional Detail: regarding the API site specific requirement in 0.0.2.

image

Point 7 Additional Detail

Is the optional post parameter: "battery" and "subproject" the same thing?
image

@dyt811 Thanks for all of this detail! The screenshots are very illustrative.

@johnsaigle

Why some endpoints do not care about trailing slash? /login vs /login/ vs /candidate vs /candidates/: Login don't care trailing slash, Candidate one will fail in a 200 way on /candidates.

This is due to apache that refuse to serve directories as endpoints. Under api/v.../ the is a projects directory and a candidates directory. This is why you nee to add a / at the end sur the rewrite rules catches it.
The transfer of endpoints in the api modules will allow for /projects and /candidates to work.

@xlecours Do you know whether these issues are addressed by your changes to the API?

@xlecours @dyt811 After 22.0-release comes out (should be very soon), can you revisit this issue and see whether the inconsistencies are still present with the latest API?

Closing this because it's very old, has not received feedback, and because the API has been completely reworked since then.

If this continues to be an issue please feel free to re-open this issue.

Was this page helpful?
0 / 5 - 0 ratings