2021-01-29 04:02:34 +03:00
|
|
|
.. meta::
|
|
|
|
:description: Manage RESTified endpoints with the Hasura schema/metadata API
|
|
|
|
:keywords: hasura, docs, restified-endpoints/metadata API, API reference, RESTified endpoints
|
|
|
|
|
2022-01-10 21:39:15 +03:00
|
|
|
.. _schema_metadata_api_restified_endpoints:
|
2021-01-29 04:02:34 +03:00
|
|
|
|
2021-08-13 16:45:03 +03:00
|
|
|
Schema/Metadata API Reference: RESTified GraphQL Endpoints (Deprecated)
|
|
|
|
=======================================================================
|
2021-01-29 04:02:34 +03:00
|
|
|
|
2022-02-16 21:33:05 +03:00
|
|
|
.. 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.
|
|
|
|
|
2021-01-29 04:02:34 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
------------
|
|
|
|
|
|
|
|
Add/Remove a RESTified GraphQL endpoint to Hasura GraphQL engine.
|
|
|
|
|
2022-01-10 21:39:15 +03:00
|
|
|
.. _schema_metadata_create_rest_endpoint:
|
2021-01-29 04:02:34 +03:00
|
|
|
|
|
|
|
create_rest_endpoint
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
``create_rest_endpoint`` is used to associate a URL template with a query.
|
|
|
|
|
|
|
|
An example request as follows:
|
|
|
|
|
|
|
|
.. code-block:: http
|
|
|
|
|
|
|
|
POST /v1/query HTTP/1.1
|
|
|
|
Content-Type: application/json
|
|
|
|
X-Hasura-Role: admin
|
|
|
|
|
|
|
|
{
|
|
|
|
"type": "create_rest_endpoint",
|
|
|
|
"args": {
|
|
|
|
"name": "example-name",
|
|
|
|
"url": "example",
|
|
|
|
"methods": ["POST","PUT","PATCH"],
|
|
|
|
"definition": {
|
|
|
|
"query": {
|
|
|
|
"query_name": "example_mutation",
|
|
|
|
"collection_name": "test_collection"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"comment": "some optional comment"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-10 21:39:15 +03:00
|
|
|
.. _schema_metadata_create_rest_endpoint_syntax:
|
2021-01-29 04:02:34 +03:00
|
|
|
|
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
|
|
|
|
|
|
|
* - Key
|
|
|
|
- Required
|
|
|
|
- Schema
|
|
|
|
- Description
|
|
|
|
* - name
|
|
|
|
- true
|
|
|
|
- Text
|
|
|
|
- A unique identifier for the endpoint
|
|
|
|
* - url
|
|
|
|
- true
|
|
|
|
- :ref:`EndpointUrl`
|
|
|
|
- URL of the REST endpoint
|
|
|
|
* - methods
|
|
|
|
- true
|
|
|
|
- :ref:`EndpointMethods`
|
|
|
|
- Non-Empty case sensitive list of supported HTTP Methods
|
|
|
|
* - definition
|
|
|
|
- true
|
|
|
|
- :ref:`EndpointDef`
|
|
|
|
- Definition for the REST endpoint
|
|
|
|
* - comment
|
|
|
|
- false
|
|
|
|
- Text
|
|
|
|
- comment
|
|
|
|
|
2021-03-04 13:37:52 +03:00
|
|
|
.. admonition:: Supported from
|
|
|
|
|
2021-03-04 22:20:19 +03:00
|
|
|
RESTified endpoints are supported from versions ``v2.0.0-alpha.1`` and above.
|
2021-03-04 13:37:52 +03:00
|
|
|
|
2022-01-10 21:39:15 +03:00
|
|
|
.. _schema_metadata_drop_rest_endpoint:
|
2021-01-29 04:02:34 +03:00
|
|
|
|
|
|
|
drop_rest_endpoint
|
|
|
|
------------------
|
|
|
|
|
|
|
|
``drop_rest_endpoint`` is used to delete an existing RESTified GraphQL Endpoint.
|
|
|
|
|
|
|
|
An example request as follows:
|
|
|
|
|
|
|
|
.. code-block:: http
|
|
|
|
|
|
|
|
POST /v1/query HTTP/1.1
|
|
|
|
Content-Type: application/json
|
|
|
|
X-Hasura-Role: admin
|
|
|
|
|
|
|
|
{
|
|
|
|
"type": "drop_rest_endpoint",
|
|
|
|
"args": {
|
2021-02-23 14:23:01 +03:00
|
|
|
"name": "name_of_the_endpoint"
|
2021-01-29 04:02:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 21:39:15 +03:00
|
|
|
.. _schema_metadata_drop_rest_endpoint_syntax:
|
2021-01-29 04:02:34 +03:00
|
|
|
|
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
|
|
|
|
|
|
|
* - Key
|
|
|
|
- Required
|
|
|
|
- Schema
|
|
|
|
- Description
|
2021-02-23 14:23:01 +03:00
|
|
|
* - name
|
2021-01-29 04:02:34 +03:00
|
|
|
- true
|
2021-02-23 14:23:01 +03:00
|
|
|
- Text
|
2021-01-29 04:02:34 +03:00
|
|
|
- URL of the RESTified endpoint
|
2021-03-04 13:37:52 +03:00
|
|
|
|
|
|
|
.. admonition:: Supported from
|
|
|
|
|
2021-03-04 22:20:19 +03:00
|
|
|
RESTified endpoints are supported from versions ``v2.0.0-alpha.1`` and above.
|