GraphQL
Graphiql Examples:
Queries:
1-- Query Input --
2 query {
3 locations(
4 limit:10
5 after:0
6 userId:2
7 columnName:"id"
8 direction:"asc"
9 ){
10 totalCount
11 edges {
12 node{
13 id
14 address_line_1
15 address_line_2
16 city
17 state
18 zipcode
19 longitude
20 latitude
21 user_id
22 created_at
23 updated_at
24 }
25 cursor
26 }
27 pageInfo{
28 endCursor
29 hasNextPage
30 }
31 errorMsg
32 }
33 }
34
35
1-- Query Output --
2{
3 "data": {
4 "locations": {
5 "totalCount": 4,
6 "edges": [
7 {
8 "node": {
9 "id": 3,
10 "address_line_1": "42 Wallaby Way",
11 "address_line_2": "",
12 "city": "Sydney",
13 "state": "CA",
14 "zipcode": 95826,
15 "longitude": null,
16 "latitude": null,
17 "user_id": null,
18 "created_at": "2021-07-29 21:41:18",
19 "updated_at": "2021-07-29 21:41:18"
20 },
21 "cursor": 0
22 },
23 {
24 "node": {
25 "id": 4,
26 "address_line_1": "42 Wallaby Way",
27 "address_line_2": "",
28 "city": "Sydney",
29 "state": "CA",
30 "zipcode": 95826,
31 "longitude": null,
32 "latitude": null,
33 "user_id": null,
34 "created_at": "2021-07-29 22:07:44",
35 "updated_at": "2021-07-29 22:07:44"
36 },
37 "cursor": 1
38 }
39 ],
40 "pageInfo": {
41 "endCursor": 1,
42 "hasNextPage": false
43 },
44 "errorMsg": null
45 }
46 }
47}
Root Query for Entity (Non-Named Query):
1-- Query Input --
2{
3 location(id: 5) {
4 id
5 address_line_1
6 address_line_2
7 city
8 state
9 zipcode
10 longitude
11 latitude
12 user_id
13 }
14}
1-- Query Output --
2{
3 "data": {
4 "location": {
5 "id": 5,
6 "address_line_1": "42 Wallaby Way",
7 "address_line_2": "",
8 "city": "Sydney",
9 "state": "CA",
10 "zipcode": 94102,
11 "longitude": null,
12 "latitude": null,
13 "user_id": 2,
14 }
15 }
16}
Mutations:
1-- Mutation Input --
2 mutation {
3 editLocation(input: {
4 id: 4 # id input indicates which location entry to edit
5 address_line_1: "800 Test Ct" # this input and any additional inputs in a single mutation indicate which fields to edit
6 }) { # the field list below indicates which fields to display with the output
7 location {
8 id
9 address_line_1
10 address_line_2
11 city
12 state
13 zipcode
14 longitude
15 latitude
16 user_id
17 }
18 }
19 }
1-- Mutation Output --
2{
3"data": {
4 "editLocation": {
5 "location": {
6 "id": 4,
7 "address_line_1": "42 Wallaby Way",
8 "address_line_2": "",
9 "city": "Sydney",
10 "state": "CA",
11 "zipcode": 94102,
12 "longitude": null,
13 "latitude": null,
14 "user_id": 3,
15 }
16 }
17}
18}