Skip to main content

This cube is the new api which will be integrated in CubicWeb 4.

Project description

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.

Vision

The goal is to offer a minimal API surface, similar to data-servers compatible with SPARQL. To this end, this API mainly offers a route to send RQL requests to.

There are only a few helper endpoints to login, fetch the data schema and retrieve debug information about the server setup. Those are either impossible to express in RQL, or essential to have to simplify debugging.

We will not create endpoints to make common RQL requests easier. Instead it is the responsibility of each client to make creating those requests easier by offering helpers.

If you have trouble expressing your need through RQL, please ask your question in our Matrix channel or open an issue on the CubicWeb Repository. Depending on the need we may update RQL to add new features!

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.

Existing instances

If you are adding the api to an existing instance, you need to manually add the cube and run a migration. To do so, run the following commands (replacing <YOUR_INSTANCE> with your instance name):

Open a shell using cubicweb-ctl shell <YOUR_INSTANCE>. In that shell type add_cube(api), then exit() to leave the shell.

And finally upgrade your instance:

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 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).

  • in pyramid.ini: * cubicweb_api.enable_login_route: Set to “yes” to enable the login route, “no” to disable it. Defaults to “no”.

Available Routes

This cube uses the OpenAPI specification to describe and validate data. The complete specification is available in openapi_template.yaml.

Please note the login route will not appear in the OpenAPI specification if it is disabled (see section “Configuration options”).

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.

Troubleshooting

Pyramid

Depending on your pyramid configuration, you may need to manually include the api routes by adding this line in your pyramid.ini

cubicweb.includes = cubicweb_api

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cubicweb-api-0.10.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cubicweb_api-0.10.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file cubicweb-api-0.10.0.tar.gz.

File metadata

  • Download URL: cubicweb-api-0.10.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cubicweb-api-0.10.0.tar.gz
Algorithm Hash digest
SHA256 bfdbf3ff365c0ffaff5b802791d8500fda98071b4b655bf14ede0b897a94167c
MD5 cd35cf3a188bece2de5af3855893002f
BLAKE2b-256 0b6734db8cda5d8f3e39524dcb4b7bb8797fd7a9a5c780f3a1a322f89ced5428

See more details on using hashes here.

File details

Details for the file cubicweb_api-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: cubicweb_api-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cubicweb_api-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b487ea3a7a631f014a184edca79523fcd4799994233cddb07a206e358e777f9e
MD5 645d31cb60a692afb1dd1301e83d7535
BLAKE2b-256 a706760f6396fedace9cee2232add45ac3f4779185c9eceb4e56239258b2bf1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page