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

API GET /proposal/visits/{visit} endpoint requires prop param but not documented #217

Open
jlmuir opened this issue Apr 13, 2021 · 3 comments · Fixed by #723
Open

API GET /proposal/visits/{visit} endpoint requires prop param but not documented #217

jlmuir opened this issue Apr 13, 2021 · 3 comments · Fixed by #723

Comments

@jlmuir
Copy link
Contributor

jlmuir commented Apr 13, 2021

The GET /proposal/visits/{visit} endpoint requires the prop parameter, but the Swagger API spec doc does not list it as a parameter nor indicate that it is required. For example, the GET request

/api/proposal/visits/sw12345-1

fails with the following exception:

exception 'ErrorException' with message 'Undefined index: prop' in /www/api/src/Page.php:518
Stack trace:
#0 /www/api/src/Page.php(518): Slim\Slim::handleErrors(8, 'Undefined index...', '/www/api/src/P....', 518, Array)
#1 /www/api/src/Page/Proposal.php(291): SynchWeb\Page->arg('prop')
#2 [internal function]: SynchWeb\Page\Proposal->_get_visits('sw12345-1')
#3 /www/api/vendor/slim/slim/Slim/Route.php(462): call_user_func_array(Array, Array)
#4 /www/api/vendor/slim/slim/Slim/Slim.php(1326): Slim\Route->dispatch()
#5 /www/api/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#6 /www/api/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#7 /www/api/vendor/slim/slim/Slim/Slim.php(1271): Slim\Middleware\MethodOverride->call()
#8 /www/api/src/Dispatch.php(47): Slim\Slim->run()
#9 /www/api/index.php(85): SynchWeb\Dispatch->dispatch()
#10 {main}

However, it succeeds if the prop parameter is specified in the GET request:

/api/proposal/visits/sw12345-1?prop=sw12345
@ndg63276
Copy link
Collaborator

Forgive my ignorance but how do I see the Swagger spec doc?

@jlmuir
Copy link
Contributor Author

jlmuir commented Nov 29, 2023

The API docs are at api/docs (or in case it changes in the future, cd780d6). Near the top of README.md in that directory is a link to the Swagger spec file:

https://github.com/DiamondLightSource/SynchWeb/blob/master/api/docs/dist/spec.json

You can open that and click on the Raw button to get the raw URL:

https://raw.githubusercontent.com/DiamondLightSource/SynchWeb/master/api/docs/dist/spec.json

Then, you can open the Swagger Editor, and choose File > Import URL, and enter the raw URL to the Swagger spec.

@ndg63276
Copy link
Collaborator

ndg63276 commented Nov 30, 2023

Have made an internal ticket (LIMS-1138) to work on this.

@ndg63276 ndg63276 linked a pull request Feb 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants