This application uses graphql-spqr with its Spring Boot support and integrates Spring Security to authenticate callers.
With the default login of user/testing, the following curl operation can be used to query the
curl --request POST \
--url http://localhost:8080/graphql \
--header 'authorization: Basic dXNlcjp0ZXN0aW5n' \
--header 'content-type: application/json' \
--data '{"query":"{\n entry(id:\"1\") {\n id\n owner\n when\n tags\n }\n}"}'
or GraphQL form is:
{
entry(id:"1") {
id
owner
when
tags
}
}which will give a JSON response like:
{
"data": {
"entry": {
"id": "1",
"owner": "user",
"when": "2018-12-27T16:12:05.440Z",
"tags": [
"red",
"green",
"blue"
]
}
}
}The response is contrived, but derived from the query to verify the operation:
idis always the one given in the query parameterowneris the Spring Security authenticated usernamewhenis always the current date/timetagsalways contains the values red, green, blue