Query (POST)
Performs a query in the GraphQL instance of the current site resolved for the request.
Note
The query
string must be a valid GraphQL query as described in the
official docs
Resource Information
This service uses the tomcat application on port 8080 by default. To see a list of default ports click here
The context for this API is /
.
HTTP Verb
|
POST
|
URL
|
/api/1/site/graphql |
Response Formats
|
JSON |
Example
Request
POST .../api/1/site/graphql.json
1{
2 "query": "query ArticlesByAuthor($author:String) {
3 page_article {
4 total
5 items {
6 title
7 author(filter:{matches:$author})
8 date_dt
9 }
10 }
11 }",
12 "variables": "{
13 \"author\": \"Jane\"
14 }"
15}
Response
Status 200 OK
1{
2 "data": {
3 "page_article": {
4 "total": 9,
5 "items": [
6 {
7 "title": "New ACME Phone Released Today",
8 "author": "John Doe",
9 "date_dt": "2016-07-03T04:00:00Z"
10 },
11 {
12 "title": "Top Clubs In Virginia",
13 "author": "John Doe",
14 "date_dt": "2017-03-05T05:00:00Z"
15 },
16 {
17 "title": "Coffee is Good for Your Health",
18 "author": "John Doe",
19 "date_dt": "2016-06-14T04:00:00Z"
20 },
21 {
22 "title": "5 Popular Diets for Women",
23 "author": "Jane Doe",
24 "date_dt": "2017-03-14T04:00:00Z"
25 },
26 {
27 "title": "Top Romantic Valentine Movies",
28 "author": "Jane Doe",
29 "date_dt": "2017-02-14T05:00:00Z"
30 },
31 {
32 "title": "10 Tips to Get a Six Pack",
33 "author": "John Doe",
34 "date_dt": "2017-02-08T05:00:00Z"
35 },
36 {
37 "title": "Women Styles for Winter",
38 "author": "Jane Doe",
39 "date_dt": "2017-01-03T05:00:00Z"
40 },
41 {
42 "title": "Men Styles For Winter",
43 "author": "John Doe",
44 "date_dt": "2017-01-05T05:00:00Z"
45 },
46 {
47 "title": "Top Books For Young Women",
48 "author": "Jane Doe",
49 "date_dt": "2016-12-28T05:00:00Z"
50 }
51 ]
52 }
53 }
54}
Responses
Status
|
Location
|
Response Body
|
---|---|---|
200
|
See example above.
|
|
500
|
"Internal server error" |