graphql-engine/docs/graphql/core/api-reference/schema-metadata-api/restified-endpoints.rst
Sameer Kolhar 509b1fda1b console: REST endpoints UI
Co-authored-by: Abhijeet Singh Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com>
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: 9cd313c1b3fd2bfada7caf24e379c95ec15ce2cb
2021-02-23 11:24:06 +00:00

117 lines
2.3 KiB
ReStructuredText

.. meta::
:description: Manage RESTified endpoints with the Hasura schema/metadata API
:keywords: hasura, docs, restified-endpoints/metadata API, API reference, RESTified endpoints
.. _api_restified_endpoints:
Schema/Metadata API Reference: RESTified GraphQL Endpoints
==========================================================
.. contents:: Table of contents
:backlinks: none
:depth: 1
:local:
Introduction
------------
Add/Remove a RESTified GraphQL endpoint to Hasura GraphQL engine.
.. _create_rest_endpoint:
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"
}
}
.. _create_rest_endpoint_syntax:
.. 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
.. _drop_rest_endpoint:
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": {
"name": "name_of_the_endpoint"
}
}
.. _drop_rest_endpoint_syntax:
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - name
- true
- Text
- URL of the RESTified endpoint