2020-01-14 15:57:45 +03:00
|
|
|
.. meta::
|
|
|
|
:description: Hasura API reference
|
|
|
|
:keywords: hasura, docs, API, API reference
|
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
.. _api_reference:
|
2019-10-23 12:23:41 +03:00
|
|
|
|
2018-10-08 17:12:03 +03:00
|
|
|
API Reference
|
|
|
|
=============
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2018-12-03 15:12:24 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2019-04-30 11:34:08 +03:00
|
|
|
Available APIs
|
|
|
|
--------------
|
|
|
|
|
2021-01-29 08:48:17 +03:00
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| API | Endpoint | Access |
|
|
|
|
+==================================+===================================================+==================+
|
|
|
|
| GraphQL | :ref:`/v1/graphql <graphql_api>` | Permission rules |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Relay | :ref:`/v1beta1/relay <relay_api>` | Permission rules |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Legacy GraphQL | :ref:`/v1alpha1/graphql <graphql_api>` | Permission rules |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Schema/Metadata *(< v1.3)* | :ref:`/v1/query <schema_metadata_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Schema *(> v1.4)* | :ref:`/v2/query <schema_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Metadata *(> v1.4)* | :ref:`/v1/metadata <metadata_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Restified GQL | :ref:`/api/rest <restified_api>` | GQL REST Routes |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Version | :ref:`/v1/version <version_api>` | Public |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Health | :ref:`/healthz <health_api>` | Public |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| PG Dump | :ref:`/v1alpha1/pg_dump <pg_dump_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Config | :ref:`/v1alpha1/config <config_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
|
|
|
| Explain | :ref:`/v1/graphql/explain <explain_api>` | Admin only |
|
|
|
|
+----------------------------------+---------------------------------------------------+------------------+
|
2019-04-30 11:34:08 +03:00
|
|
|
|
|
|
|
.. _graphql_api:
|
|
|
|
|
2018-10-08 17:12:03 +03:00
|
|
|
GraphQL API
|
2019-04-30 11:34:08 +03:00
|
|
|
^^^^^^^^^^^
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2018-10-08 17:12:03 +03:00
|
|
|
All GraphQL requests for queries, subscriptions and mutations are made to the GraphQL API.
|
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`api_reference_graphql`.
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2020-06-23 23:08:41 +03:00
|
|
|
.. _relay_api:
|
|
|
|
|
|
|
|
Relay API
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
Hasura exposes a Relay schema for GraphQL requests for queries, subscriptions and mutations.
|
|
|
|
|
|
|
|
See docs at :ref:`relay_schema`.
|
|
|
|
|
2020-10-05 17:19:22 +03:00
|
|
|
See details at :ref:`api_reference_relay_graphql`.
|
|
|
|
|
2019-04-30 11:34:08 +03:00
|
|
|
.. _schema_metadata_api:
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2021-02-23 15:00:19 +03:00
|
|
|
Schema / metadata API (v1.3 and below)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
Hasura exposes a schema / metadata API for managing metadata for permissions/relationships or for directly
|
2018-10-08 17:12:03 +03:00
|
|
|
executing SQL on the underlying Postgres.
|
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
This is primarily intended to be used as an ``admin`` API to manage the Hasura schema and metadata.
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2021-01-29 08:48:17 +03:00
|
|
|
See details at :ref:`schema_metadata_apis` .
|
|
|
|
|
|
|
|
.. _schema_api:
|
|
|
|
|
|
|
|
Schema API (v1.4 and above)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Hasura exposes a schema API for directly executing SQL on the underlying Postgres.
|
|
|
|
|
|
|
|
This is primarily intended to be used as an ``admin`` API to manage the Hasura schema.
|
|
|
|
|
|
|
|
See details at :ref:`schema_apis`.
|
|
|
|
|
|
|
|
.. _metadata_api:
|
|
|
|
|
|
|
|
Metadata API (v1.4 and above)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Hasura exposes a metadata API for managing metadata.
|
|
|
|
|
|
|
|
This is primarily intended to be used as an ``admin`` API to manage the Hasura metadata.
|
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`metadata_apis`.
|
2019-04-30 11:34:08 +03:00
|
|
|
|
|
|
|
.. _version_api:
|
|
|
|
|
2021-01-29 04:02:34 +03:00
|
|
|
RESTified GraphQL API
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Hasura allows saved GraphQL queries and mutations to be accesed through a REST interface.
|
|
|
|
|
|
|
|
See details at :ref:`restified_api_reference`.
|
|
|
|
|
|
|
|
.. _restified_api:
|
|
|
|
|
2019-04-30 11:34:08 +03:00
|
|
|
Version API
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
2019-12-15 16:00:22 +03:00
|
|
|
The ``/v1/version`` is a public endpoint that responds with the current server version in JSON format.
|
2019-04-30 11:34:08 +03:00
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`version_api_reference`.
|
2019-04-30 11:34:08 +03:00
|
|
|
|
|
|
|
.. _health_api:
|
|
|
|
|
|
|
|
Health check API
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
2019-12-15 16:00:22 +03:00
|
|
|
The ``/healthz`` is a public endpoint that returns the server health status.
|
2019-04-30 11:34:08 +03:00
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`health_api_reference`.
|
2019-04-30 11:34:08 +03:00
|
|
|
|
|
|
|
.. _pg_dump_api:
|
|
|
|
|
|
|
|
pg_dump API
|
|
|
|
^^^^^^^^^^^
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2019-06-11 16:29:03 +03:00
|
|
|
The ``/v1alpha1/pg_dump`` is an admin-only endpoint that can be used to execute
|
|
|
|
``pg_dump`` on the Postgres instance connected to Hasura. The ``pg_dump`` CLI
|
2019-09-11 10:17:14 +03:00
|
|
|
tool's argument can be passed as a POST request body to the API and the response
|
2019-06-11 16:29:03 +03:00
|
|
|
is sent back to the client.
|
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`pg_dump_api_reference`.
|
2019-06-11 16:29:03 +03:00
|
|
|
|
|
|
|
.. _config_api:
|
|
|
|
|
|
|
|
Config API
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
``v1alpha1/config`` is an admin-only endpoint to get the current server
|
|
|
|
configuration.
|
2018-10-08 17:12:03 +03:00
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`config_api_reference`.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-02-03 09:34:44 +03:00
|
|
|
.. _explain_api:
|
|
|
|
|
|
|
|
Explain API
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
``v1/graphql/explain`` returns the Postgres plan for a query or subscription based
|
|
|
|
on the defined permissions.
|
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
See details at :ref:`explain_api_reference`.
|
2020-02-03 09:34:44 +03:00
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
:hidden:
|
|
|
|
|
2019-04-30 11:34:08 +03:00
|
|
|
GraphQL API <graphql-api/index>
|
2020-10-05 17:19:22 +03:00
|
|
|
Relay GraphQL API <relay-graphql-api/index>
|
2021-02-23 15:00:19 +03:00
|
|
|
Schema / Metadata APIs <schema-metadata-api/index>
|
|
|
|
Schema APIs (v1.4 and above) <schema-api/index>
|
|
|
|
Metadata APIs (v1.4 and above) <metadata-api/index>
|
2021-01-29 04:02:34 +03:00
|
|
|
RESTified GraphQL Endpoints <restified>
|
2019-12-15 16:00:22 +03:00
|
|
|
Version API <version>
|
|
|
|
Health check API <health>
|
2019-04-30 11:34:08 +03:00
|
|
|
PG Dump API <pgdump>
|
2019-06-11 16:29:03 +03:00
|
|
|
Config API <config>
|
2020-02-03 09:34:44 +03:00
|
|
|
Explain API <explain>
|