Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
api
Commits
d9fe64e92218
Commit
d9fe64e92218
authored
2 years ago
by
Arnaud Vergnet
Browse files
Options
Downloads
Patches
Plain Diff
docs: update readme
parent
a76dbcf0c701
Loading
Loading
1 merge request
!25
docs: update readme
Pipeline
#140334
passed
2 years ago
Stage: lint
Stage: tests
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+83
-2
83 additions, 2 deletions
README.rst
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
84 additions
and
3 deletions
README
→
README
.rst
+
83
−
2
View file @
d9fe64e9
Summary
-------
This cube is the new api which will be integrated in CubicWeb 4.
================
.. Useful links
.. _RQLController cube: https://forge.extranet.logilab.fr/cubicweb/cubes/rqlcontroller
.. _CubicWebJS: https://forge.extranet.logilab.fr/cubicweb/cubicwebjs
.. _React Admin CubicWeb: https://forge.extranet.logilab.fr/cubicweb/react-admin
.. _OpenAPI: https://www.openapis.org
.. _JWT: https://jwt.io
This cube exposes the new api, replacing the `RQLController cube`_ with a simpler architecture.
We plan on integrating this new API directly into CubicWeb, without having to rely on this cube.
You can use the `CubicWebJS`_ client to communicate with this API in JavaScript.
See the project `React Admin CubicWeb`_ for an example on how to use `CubicWebJS`_.
**⚠️ Please note this cube will later be integrated into CubicWeb.
The installation instructions only applies for the API cube while it lives in its own repository.**
Setup
-----
Install this cube with pip by running:
``pip install cubicweb_api``
Then open the ``__pkginfo__.py`` of your CubicWeb instance
and add ``cubicweb-api`` in the ``__depends__`` dictionary.
The last step is to upgrade your instance by the following command
(replacing ``<YOUR_INSTANCE>`` with your instance name):
``cubicweb-ctl upgrade <YOUR_INSTANCE>``
The command will ask you to edit the ``all-in-one.conf`` file.
Accept the changes to write the default configuration options available for this cube.
Configuration options
~~~~~~~~~~~~~~~~~~~~~
There are 2 configuration options for this cube available in ``all-in-one.conf``:
* ``api-path-prefix``
Prefix used for the url path.The api version number will be added after this prefix (only v1 for now).
* ``api-server-name``
The base url to use for openapi validation. Set this to the CubicWeb base url if openapi cannot find the server.
Available Routes
----------------
This cube uses the `OpenAPI`_ specification to describe and validate data.
The complete specification is available in `openapi_template.yaml <cubicweb_api/openapi/openapi_template.yaml>`_,
but here is a short recap of all the available routes:
* ``/schema``
Returns this instance's Schema
* ``/rql``
Executes the given RQL query
* ``/login``
Tries to log in the user
* ``/transaction/<ACTION>``
Manages transactions. Replace ``<ACTION>`` with ``begin``, ``execute``, ``commit`` or ``rollback``.
The real path will depend on your configuration. When using the default configuration,
if your instance lives in ``https://example.com``, then the routes will live in ``https://example.com/api/v1/``.
Authentication
--------------
When sending valid credentials to the login route,
a `JWT`_ token will be generated and sent in the ``Set-Cookie`` header.
This token must be sent as a cookie for each request to be successful.
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
d9fe64e9
...
...
@@ -46,7 +46,7 @@
author_email
=
__pkginfo__
[
"
author_email
"
]
classifiers
=
__pkginfo__
[
"
classifiers
"
]
with
open
(
join
(
here
,
"
README
"
))
as
f
:
with
open
(
join
(
here
,
"
README
.rst
"
))
as
f
:
long_description
=
f
.
read
()
# get optional metadatas
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment