Skip to content

Commit

Permalink
📝 Document query-time-limit GraphQL configuration option and improve …
Browse files Browse the repository at this point in the history
…Response section in page /docs/mongodb-graphql
  • Loading branch information
ujibang committed Nov 15, 2023
1 parent 3244eb1 commit 2898de2
Showing 1 changed file with 21 additions and 53 deletions.
74 changes: 21 additions & 53 deletions docs/mongodb-graphql/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ graphql:
default-limit: 100
# max-limit is the maximum value for a Query limit
max-limit: 1000
# The time limit in milliseconds for processing queries. Set to 0 for no time limit.
query-time-limit: 0
verbose: false
----

Expand Down Expand Up @@ -605,66 +607,32 @@ The GraphQL service has the following limitations:

- **Read-only API**: mutations are not supported; the GraphQL API is only intended for simplifying data fetching. To write data, the REST API must be used.

## Response codes
## Response

In the following table are reported possible RESTHeart GraphQL Service responses:
Starting from RESTHeart v7.6, the GraphQL API always responds with the content type `application/graphql-response+json`, following the link:https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md[GraphQL Over HTTP specs].

[cols="1,4"]
|===
|*HTTP Status code*|*description*
|200
|It's all OK!
|400
|Invalid GraphQL query (e.g. required fields are not in the schema, argument type mismatch), schema - MongoDB data type mismatch, invalid app definition
|401
|Unauthorized
|404
|There is no GraphQL app bound to the requested endpoint
|405
|HTTP method used not supported
|500
|Internal Server Error|
**Possible Response Codes:**

[cols="1,4", options="header"]
|===
| *HTTP Status Code* | *Description*

== Example responses
| 200
| A valid GraphQL response has been generated, even if it contains errors (partial data).

*200 - OK*
| 400
| The request is invalid (e.g., incorrect JSON, malformed GraphQL query, non-existent fields in selection, etc.) or when the response only contains errors (i.e., `data: null`).

[source,json]
----
{
"data":{
"userByName":[
{
"firstName": "nameUser1",
"lastName": "surnameUser1"
},
{
"firstName": "nameUser2",
"lastName": "surnameUser2"
}
]
}
}
----
| 404
| The GraphQL app does not exist.

*400 - Bad Request - Invalid GraphQL Query / schema - MongoDB data type mismatch*
| 405
| Incorrect method used (not POST or OPTIONS).

[source,json]
----
{
"data": "...",
"errors" : "..."
}
----
| 408
| Request timed out due to the `query-time-limit` option.

*400 - Bad Request - Invalid GraphQL App Definition*
| 500
| Connection error with MongoDB.

[source,json]
----
{
"http status code": 400,
"http status description": "Bad Request",
"message": "..."
}
----
|===

0 comments on commit 2898de2

Please sign in to comment.