mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
02aef27a75
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2632 Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com> Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com> GitOrigin-RevId: 067e182effaed255ff047abeee309d65a9fb191c
264 lines
8.4 KiB
YAML
264 lines
8.4 KiB
YAML
- description: Try to add a POST rest endpoint with arguments in URL
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: create_rest_endpoint
|
|
args:
|
|
url: with_args_url/:first_name/:last_name
|
|
name: with_args_url
|
|
methods:
|
|
- POST
|
|
definition:
|
|
query:
|
|
collection_name: test_collection
|
|
query_name: query_with_args
|
|
|
|
- description: Try to add a POST rest endpoint with default argument
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: create_rest_endpoint
|
|
args:
|
|
url: with_default_arg
|
|
name: with_default_arg
|
|
methods:
|
|
- POST
|
|
definition:
|
|
query:
|
|
collection_name: test_collection
|
|
query_name: query_with_default_arg
|
|
|
|
- description: Try to add a POST rest mutation endpoint
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: create_rest_endpoint
|
|
args:
|
|
url: mutation_with_args
|
|
name: mutation_with_args
|
|
methods:
|
|
- POST
|
|
definition:
|
|
query:
|
|
collection_name: test_collection
|
|
query_name: mutation_with_args
|
|
|
|
- description: Call openapi json endpoint
|
|
url: /api/swagger/json
|
|
method: GET
|
|
status: 200
|
|
query:
|
|
response:
|
|
openapi: 3.0.0
|
|
info:
|
|
version: ''
|
|
title: Rest Endpoints
|
|
description: This OpenAPI specification is automatically generated by Hasura.
|
|
paths:
|
|
/api/rest/mutation_with_args:
|
|
post:
|
|
summary: mutation_with_args
|
|
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
|
|
mutation ($first_name: String!, $last_name: String!) { insert_test_table(\
|
|
\ objects: {first_name: $first_name, last_name: $last_name }) { returning\
|
|
\ { id } affected_rows } }\n```"
|
|
parameters:
|
|
- schema:
|
|
type: string
|
|
in: header
|
|
name: x-hasura-admin-secret
|
|
description: Your x-hasura-admin-secret will be used for authentication
|
|
of the API request.
|
|
- schema:
|
|
type: string
|
|
in: query
|
|
name: first_name
|
|
description: _"first_name" is required (enter it either in parameters or request body)_
|
|
- schema:
|
|
type: string
|
|
in: query
|
|
name: last_name
|
|
description: _"last_name" is required (enter it either in parameters or request body)_
|
|
requestBody:
|
|
required: false
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
first_name:
|
|
type: string
|
|
nullable: false
|
|
last_name:
|
|
type: string
|
|
nullable: false
|
|
description: Query parameters can also be provided in the request body
|
|
as a JSON object
|
|
responses:
|
|
'200':
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
insert_test_table:
|
|
type: object
|
|
properties:
|
|
returning:
|
|
items:
|
|
type: object
|
|
properties:
|
|
id:
|
|
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
|
|
title: uuid
|
|
type: string
|
|
type: array
|
|
nullable: false
|
|
affected_rows:
|
|
title: Int
|
|
type: integer
|
|
description: Responses for POST /api/rest/mutation_with_args
|
|
/api/rest/with_default_arg:
|
|
post:
|
|
summary: with_default_arg
|
|
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
|
|
query ($first_name:String=\"Foo\") { test_table(where: {first_name: {\
|
|
\ _eq: $first_name } }) { first_name last_name } }\n```"
|
|
parameters:
|
|
- schema:
|
|
type: string
|
|
in: header
|
|
name: x-hasura-admin-secret
|
|
description: Your x-hasura-admin-secret will be used for authentication
|
|
of the API request.
|
|
- schema:
|
|
default: Foo
|
|
type: string
|
|
in: query
|
|
name: first_name
|
|
requestBody:
|
|
required: false
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
first_name:
|
|
default: Foo
|
|
type: string
|
|
nullable: true
|
|
description: Query parameters can also be provided in the request body
|
|
as a JSON object
|
|
responses:
|
|
'200':
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
test_table:
|
|
items:
|
|
type: object
|
|
properties:
|
|
first_name:
|
|
title: String
|
|
type: string
|
|
last_name:
|
|
title: String
|
|
type: string
|
|
type: array
|
|
nullable: false
|
|
description: Responses for POST /api/rest/with_default_arg
|
|
/api/rest/with_args_url/{first_name}/{last_name}:
|
|
post:
|
|
summary: with_args_url
|
|
description: "***\nThe GraphQl query for this endpoint is:\n``` graphql\n\
|
|
query ($first_name: String!, $last_name:String!) { test_table(where: {first_name:\
|
|
\ { _eq: $first_name } last_name: { _eq: $last_name }}) { first_name last_name\
|
|
\ } }\n```"
|
|
parameters:
|
|
- schema:
|
|
type: string
|
|
in: header
|
|
name: x-hasura-admin-secret
|
|
description: Your x-hasura-admin-secret will be used for authentication
|
|
of the API request.
|
|
- schema:
|
|
type: string
|
|
in: path
|
|
name: first_name
|
|
description: _"first_name" is required (enter it either in parameters or request body)_
|
|
- schema:
|
|
type: string
|
|
in: path
|
|
name: last_name
|
|
description: _"last_name" is required (enter it either in parameters or request body)_
|
|
requestBody:
|
|
required: false
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
first_name:
|
|
type: string
|
|
nullable: false
|
|
last_name:
|
|
type: string
|
|
nullable: false
|
|
description: Query parameters can also be provided in the request body
|
|
as a JSON object
|
|
responses:
|
|
'200':
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
test_table:
|
|
items:
|
|
type: object
|
|
properties:
|
|
first_name:
|
|
title: String
|
|
type: string
|
|
last_name:
|
|
title: String
|
|
type: string
|
|
type: array
|
|
nullable: false
|
|
description: Responses for POST /api/rest/with_args_url/{first_name}/{last_name}
|
|
components: {}
|
|
- description: Try to remove the endpoint
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: drop_rest_endpoint
|
|
args:
|
|
name: with_args_url
|
|
|
|
- description: Try to remove the endpoint
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: drop_rest_endpoint
|
|
args:
|
|
name: with_default_arg
|
|
|
|
- description: Try to remove the endpoint
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: drop_rest_endpoint
|
|
args:
|
|
name: mutation_with_args
|