DiamondLightSource/SynchWeb

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

Opened this issue · 3 comments

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

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

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.

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