Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAPI issueses #425

Closed
mniezgodka opened this issue Oct 31, 2018 · 2 comments · Fixed by #469
Closed

WebAPI issueses #425

mniezgodka opened this issue Oct 31, 2018 · 2 comments · Fixed by #469
Assignees
Labels
bug help wanted Hey, contributor! We need your help.

Comments

@mniezgodka
Copy link

mniezgodka commented Oct 31, 2018

Version used

  • AET 3.0.1

Context of the issue/feature

While creating AETs API test I've spotted several API related bugs:

  1. Get artifact by artifact Id for wrong artifactId returns code 500 instead of 400
    request: GET: http://aet-vagrant:8181/api/artifact?company=aet&project=aet&id=99999999
    response: HTTP ERROR 500
    expected reposne: 400 with proper error message
  2. Get metadata api for wrong correlationId returns error message text which doesn't describe the problem:
    request: GET: http://aet-vagrant:8181/api/metadata?company=aet&project=aet&correlationId=99999999
    response:{ "message": "Unable to get Suite Metadata for {company='aet', project='aet'}" }
  3. Get metadata api for wrong suite name returns error message skipping suite name:
    request: GET: http://aet-vagrant:8181/api/metadata?company=aet&project=aet&suite=no_existing_suite
    response:{ "message": "Unable to get Suite Metadata for {company='aet', project='aet'}" }
    expected reposne: { "message": "Unable to get Suite Metadata for no_existing_suite {company='aet', project='aet'}" }
  4. Get metadata by suite name and version for wrong suite version returns error message text which doesn't describe the problem:
    request: GET: http://aet-vagrant:8181/api/metadata?company=aet&project=aet&suite=main&version=999
    response:{ "message": "Unable to get Suite Metadata for {company='aet', project='aet'}" }
  5. Get correlationIds and versions by suite name for not existing suite returns wrong status code (404 instead of 400) with proper error message:
    request: GET: http://aet-vagrant:8181/api/history?company=aet&project=aet&suite=no_existing_suite
    response: 404{"message":"History not found for suite: no_existing_suite {company\u003d\u0027aet\u0027, project\u003d\u0027aet\u0027}"}
  6. Get all locked suites returns JSON object with looks like not valid json object:
    request: GET: http://aet-vagrant:8181/configs/locks
    response:{aet-aet-main2=aet-aet-main2-1540988624814, aet-aet-main=aet-aet-main-1540540651320}

Documentation link: https://github.com/Cognifide/aet/wiki/WebAPI

@malaskowski malaskowski added bug help wanted Hey, contributor! We need your help. labels Nov 2, 2018
@Jakub-Izbicki
Copy link
Contributor

Jakub-Izbicki commented Nov 13, 2018

@mniezgodka Why would you assume the right response code for a situation when we try to get some object by id (points 1. and 5.) but object with such id doesn't exist, is 400?
I think it is clear that the proper code here is 404, as it indicates that the request structure was correct (which is true in your examples), but the requested resource with such id does not exist.

@Jakub-Izbicki Jakub-Izbicki self-assigned this Nov 13, 2018
@mniezgodka
Copy link
Author

mniezgodka commented Nov 13, 2018

yeah it could works like that. For me both 404 and 400 fit that case, 404 is more precise but please take a look that there is an inconsistency and also api in cases: 2,3,4 (wrong/missing suite, version or correlation id) should response with 404 code. It doesn't meter for me which solution you will choose but please make sure to be consistent with rest of AET's APIs.

@Jakub-Izbicki Jakub-Izbicki removed their assignment Nov 27, 2018
@wblachowski wblachowski self-assigned this Jan 18, 2019
@wblachowski wblachowski mentioned this issue Jan 22, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted Hey, contributor! We need your help.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants