Sometimes it’s useful to interact with RoboHydra from an external program. The typical usecase would be setting an appropriate scenario before running a test and check the results afterwards, but there are other interesting possibilities. For that reason, RoboHydra offers a simple REST API to gather information about the loaded plugins and available heads. It allows allows you to make simple changes (attach/detach heads and start/stop scenarios).
For now, all URLs in the API return JSON. They don’t pay any attention
to the Accept
headers. See each URL for specific examples.
http://localhost:3000/robohydra-admin/rest/plugins
This call gives you the list of loaded plugins, together the full information for each plugin’s heads and scenarios. Example output (reformatted for readability):
http://localhost:3000/robohydra-admin/rest/plugins/<PLUGINNAME>
This call gives you the information (heads and scenarios) for the given plugin. Example output (reformatted for readability):
http://localhost:3000/robohydra-admin/rest/plugins/<PLUGINNAME>/heads/<HEADNAME>
This call gives you the information for the given head. Example output (reformatted for readability):
You can also detach/reattach a head by sending a POST request to that
URL with the new value for the attached
property, form-encoded. Eg.:
$ curl -X POST -d "attached=false" http://localhost:3000/robohydra-admin/rest/plugins/foo/heads/bar
{"plugin":"foo","name":"bar","attached":false}
http://localhost:3000/robohydra-admin/rest/plugins/<PLUGINNAME>/scenarios/<SCENARIONAME>
This call gives you the information for the given scenario. Example output (reformatted for readability):
You can also start/stop a scenario by sending a POST request to that
URL with the new value for the active
property, form-encoded. Eg.:
$ curl -X POST -d "active=true" http://localhost:3000/robohydra-admin/rest/plugins/foo/scenarios/testScenario
{"plugin":"foo","scenario":"testScenario","active":true}
http://localhost:3000/robohydra-admin/rest/test-results
This call gives the current assertion results for every scenario. Normally a test will be considered passed if there’s at least one assertion in the “passes” list and no assertions in the “failures” list. Example output (reformatted for readability):
http://localhost:3000/robohydra-admin/rest/summoner
This call gives the list of current hydras. Example output (reformatted for readability):
http://localhost:3000/robohydra-admin/rest/hydras/<HYDRANAME>
This call allows you to delete a hydra. You can either use the DELETE
verb or the POST verb with active=false
as a body parameter,
form-encoded. That is, these two calls are equivalent:
$ curl -X DELETE http://localhost:3000/robohydra-admin/rest/hydras/foo
$ curl -X POST -d "active=false" http://localhost:3000/robohydra-admin/rest/hydras/foo
The output will be empty and the status code will be 204 No Content.
Back to the documentation index.