Skip to main content
Version: v2.x

Schema/Metadata API Reference: RESTified GraphQL Endpoints (Deprecated)

Deprecation

In versions v2.0.0 and above, the schema/metadata API is deprecated in favour of the schema API and the metadata API.

Though for backwards compatibility, the schema/metadata APIs will continue to function.

Introduction

Add/Remove a RESTified GraphQL endpoint to Hasura GraphQL engine.

create_rest_endpoint

create_rest_endpoint is used to associate a URL template with a query.

An example request as follows:

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"
}
}

Args syntax

KeyRequiredSchemaDescription
nametrueTextA unique identifier for the endpoint
urltrueEndpointUrlURL of the REST endpoint
methodstrueEndpointMethodsNon-Empty case sensitive list of supported HTTP Methods
definitiontrueEndpointDefinitionDefinition for the REST endpoint
commentfalseTextcomment
Supported from

RESTified endpoints are supported from versions v2.0.0-alpha.1 and above.

drop_rest_endpoint

drop_rest_endpoint is used to delete an existing RESTified GraphQL Endpoint.

An example request as follows:

POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
"type": "drop_rest_endpoint",
"args": {
"name": "name_of_the_endpoint"
}
}

Args syntax

KeyRequiredSchemaDescription
nametrueTextURL of the RESTified endpoint
Supported from

RESTified endpoints are supported from versions v2.0.0-alpha.1 and above.