[PATCH] Add public API to capsul-flask #7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
These changes allow you to create a new Capsul‡ using a secure HTTP API. This makes it possible to integrate with other systems, e.g. a proposed
abra-capsul
script, which can be used standalone to create remote Capsuls from your own shell scripts, or withabra
to create and set up a new Docker Swarm server and deploy Co-op Cloud apps to it.(‡Other endpoints for details/list/delete Coming Soon™)
API tokens are revocable server-side, by users via the web console, and by administrators using manual SQL commands.
Goodies in these two commits, from the
publicapi
branch of my copy ofcapsul-flask
:cf42ac5e4d
b8d149e862
I also added some tests here: https://git.autonomic.zone/3wordchant/capsul-flask/commits/branch/publicapi-tests
(In a separate branch to make it easier to review the tests and the API separately, and on the Autonomic Gitea because of #81)
To try it out:
publicapi
orpublicapi-tests
branchesexport CAPSUL_API_TOKEN=...
)(using HTTPie, you could also use cURL or Python Requests or urllib)
The request should succeed and return the new Capsul's ID. Beware that if you're running with
SPOKE_MODEL=mock
, the Capsul metadata won't be saved to the database, see #83To run automated tests:
publicapi-tests
capsulflask_test
database, see #82python -m unittest capsulflask.tests.test_publicapi.PublicAPITests
~doubtsurgea month ago · edit
I've tested this and it works - it is running on https://yolo.servers.coop.