graphql-engine/docs/graphql/core/api-reference/schema-metadata-api/remote-schemas.rst
hasura-bot 972caf65f3 docs: move metadata api deprecation notes + update changelog + nitpicks
GITHUB_PR_NUMBER: 8186
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8186

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3684
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 6d08a9c76c008c62f70a2285afcfdde141ae68c3
2022-02-16 18:34:04 +00:00

204 lines
4.6 KiB
ReStructuredText

.. meta::
:description: Manage remote schemas with the Hasura schema/metadata API
:keywords: hasura, docs, schema/metadata API, API reference, remote schema
.. _schema_metadata_api_remote_schemas:
Schema/Metadata API Reference: Remote schemas (Deprecated)
==========================================================
.. admonition:: Deprecation
In versions ``v2.0.0`` and above, the schema/metadata API is deprecated in favour of the :ref:`schema API <schema_apis>` and the
:ref:`metadata API <metadata_apis>`.
Though for backwards compatibility, the schema/metadata APIs will continue to function.
.. contents:: Table of contents
:backlinks: none
:depth: 1
:local:
Introduction
------------
Add/Remove a remote GraphQL server as remote schema in Hasura GraphQL engine.
.. _schema_metadata_add_remote_schema:
add_remote_schema
-----------------
``add_remote_schema`` is used to add a remote GraphQL server as remote schema. GraphQL engine stitches it's schema with existing.
An example request as follows:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "add_remote_schema",
"args": {
"name": "my remote schema",
"definition": {
"url": "https://remote-server.com/graphql",
"headers": [{"name": "X-Server-Request-From", "value": "Hasura"}],
"forward_client_headers": false,
"timeout_seconds": 60
},
"comment": "some optional comment"
}
}
.. _schema_metadata_add_remote_schema_syntax:
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - name
- true
- :ref:`RemoteSchemaName`
- Name of the remote schema
* - definition
- true
- :ref:`RemoteSchemaDef`
- Definition for the remote schema
* - comment
- false
- Text
- comment
.. _schema_metadata_update_remote_schema:
update_remote_schema
--------------------
``update_remote_schema`` is used to update the configuration of a remote schema. If the remote schema URL has changed
then it will perform a introspection as well. After introspection, if there are any inconsistencies detected with other
metadata objects (like remote relationships or remote schema permissions) they will be reported as `inconsistent_metadata`.
An example request as follows:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "update_remote_schema",
"args": {
"name": "my remote schema",
"definition": {
"url": "https://remote-server.com/graphql",
"headers": [{"name": "X-Server-Request-From", "value": "Hasura"}],
"forward_client_headers": false,
"timeout_seconds": 60
},
"comment": "some optional comment"
}
}
.. _schema_metadata_update_remote_schema_syntax:
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - name
- true
- :ref:`RemoteSchemaName`
- Name of the remote schema
* - definition
- true
- :ref:`RemoteSchemaDef`
- Definition for the remote schema
* - comment
- false
- Text
- comment
.. _schema_metadata_remove_remote_schema:
remove_remote_schema
--------------------
``remove_remote_schema`` is used to delete a remote schema. GraphQL engine de-stitches it's schema.
An example request as follows:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "remove_remote_schema",
"args": {
"name": "my remote schema"
}
}
.. _schema_metadata_remove_remote_schema_syntax:
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - name
- true
- :ref:`RemoteSchemaName`
- Name of the remote schema
.. _schema_metadata_reload_remote_schema:
reload_remote_schema
--------------------
``reload_remote_schema`` is used to refresh schema of the remote server. GraphQL engine refetches schema from server and stitches.
An example request as follows:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "reload_remote_schema",
"args": {
"name": "my remote schema"
}
}
.. _schema_metadata_reload_remote_schema_syntax:
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - name
- true
- :ref:`RemoteSchemaName`
- Name of the remote schema