Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: Document HTTP and GQL usage for EdgeDB Cloud users (#6893)
* Add HTTP/GQL instructions for EdgeDB Cloud * Move TOC This TOC does not appear anywhere if the TOC is at the bottom of the document, meaning this documentation is hidden from users * Add HTTP/GQL to Cloud guide * Remove dash from RST filename * Update docs/guides/cloud/http_gql.rst Co-authored-by: Scott Trinh <scott@edgedb.com> --------- Co-authored-by: Scott Trinh <scott@edgedb.com>
- Loading branch information
1 parent
2db80d9
commit c96681e
Showing
4 changed files
with
130 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.. _ref_guide_cloud_http_gql: | ||
|
||
=================== | ||
HTTP & GraphQL APIs | ||
=================== | ||
|
||
:edb-alt-title: Querying EdgeDB Cloud over HTTP and GraphQL | ||
|
||
Using EdgeDB Cloud via HTTP and GraphQL works the same as :ref:`using any other | ||
EdgeDB instance <ref_edgeql_http>`. The two differences are in **how to | ||
discover your instance's URL** and **authentication**. | ||
|
||
|
||
Enabling | ||
======== | ||
|
||
EdgeDB Cloud can expose an HTTP endpoint for EdgeQL queries. Since HTTP is a | ||
stateless protocol, no :ref:`DDL <ref_eql_ddl>` or :ref:`transaction commands | ||
<ref_eql_statements_start_tx>`, can be executed using this endpoint. Only one | ||
query per request can be executed. | ||
|
||
In order to set up HTTP access to the database add the following to | ||
the schema: | ||
|
||
.. code-block:: sdl | ||
using extension edgeql_http; | ||
Then create a new migration and apply it using | ||
:ref:`ref_cli_edgedb_migration_create` and | ||
:ref:`ref_cli_edgedb_migrate`, respectively. | ||
|
||
Your instance can now receive EdgeQL queries over HTTP at | ||
``https://<host>:<port>/db/<database-name>/edgeql``. | ||
|
||
|
||
Instance URL | ||
============ | ||
|
||
To determine the URL of an EdgeDB Cloud instance, find the host by running | ||
``edgedb instance credentials -I <org-name>/<instance-name>``. Use the | ||
``host`` and ``port`` from that table in the URL format above this note. | ||
Change the protocol to ``https`` since EdgeDB Cloud instances are secured | ||
with TLS. | ||
|
||
Your instance can now receive EdgeQL queries over HTTP at | ||
``https://<hostname>:<port>/db/<database-name>/edgeql``. | ||
|
||
|
||
Authentication | ||
============== | ||
|
||
|
||
To authenticate to your EdgeDB Cloud instance, first create a secret key using | ||
the EdgeDB Cloud UI or :ref:`ref_cli_edgedb_cloud_secretkey_create`. Use the | ||
secret key as your token with the bearer authentication method. Here is an | ||
example showing how you might send the query ``select Person {*};`` using cURL: | ||
|
||
.. lint-off | ||
.. code-block:: bash | ||
$ curl -G https://<cloud-instance-host>:<cloud-instance-port>/db/edgedb/edgeql \ | ||
-H "Authorization: Bearer <secret-key> \ | ||
--data-urlencode "query=select Person {*};" | ||
.. lint-on | ||
Usage | ||
===== | ||
Usage of the HTTP and GraphQL APIs is identical on an EdgeDB Cloud instance. | ||
Reference the HTTP and GraphQL documentation for more information. | ||
HTTP | ||
---- | ||
- :ref:`Overview <ref_edgeql_http>` | ||
- :ref:`ref_edgeqlql_protocol` | ||
- :ref:`ref_edgeql_http_health_checks` | ||
GraphQL | ||
------- | ||
- :ref:`Overview <ref_graphql_index>` | ||
- :ref:`ref_graphql_overview` | ||
- :ref:`ref_graphql_mutations` | ||
- :ref:`ref_graphql_introspection` | ||
- :ref:`ref_cheatsheet_graphql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters