Eduflow
Search…
Paginating queries
The Eduflow API supports paginating lists of data through standard GraphQL connections.

Example

Page 1
Response
Page 2
Response
Page 3
Response
first: 2 will pick the first 2 reviews from this Teacher review activity:
1
{
2
activity(id: "5572112e-66ad-45de-bd83-1332df79f51c") {
3
... on TeacherReviewActivity {
4
title
5
activityType
6
reviews(first: 2) {
7
pageInfo {
8
hasPreviousPage
9
hasNextPage
10
endCursor
11
}
12
edges {
13
node {
14
createdAt
15
modifiedAt
16
answers {
17
booleanAnswer
18
scaleAnswer
19
textAnswer
20
comment
21
scaleAnswerPercentage
22
}
23
givers {
24
email
25
}
26
receivers {
27
email
28
}
29
}
30
}
31
}
32
}
33
}
34
}
35
Copied!
Response includes requested data and endCursor of YXJyYXljb25uZWN0aW9uOjE=, which we'll use in Page 2:
1
{
2
"data": {
3
"activity": {
4
"title": "Flow 1 - Activity 5 - Teacher's Perspective",
5
"activityType": "TeacherReview",
6
"reviews": {
7
"pageInfo": {
8
"hasPreviousPage": false,
9
"hasNextPage": true,
10
"endCursor": "YXJyYXljb25uZWN0aW9uOjE="
11
},
12
"edges": [
13
{
14
"node": {
15
"createdAt": "2021-02-03T07:06:20.054270",
16
"modifiedAt": "2021-02-03T07:06:20.054275",
17
"answers": [
18
{
19
"booleanAnswer": null,
20
"scaleAnswer": null,
21
"textAnswer": "Some awesome answer for question \"Question of type Text\" (a17d3ff4-25ac-4f15-bfde-8422112cf072) However media expert mind everything key shake manage clear until yes much realize professor defense begin national to authority among government seek performance probably compare role something image Congress next tree receive western wait bed memory dark person boy population size whom road they none spring information husband health officer past marriage officer where one success idea contain top become he case eight cell through rich late manager data every economic increase billion central almost.",
22
"comment": null,
23
"scaleAnswerPercentage": null
24
},
25
{
26
"booleanAnswer": null,
27
"scaleAnswer": 1,
28
"textAnswer": null,
29
"comment": null,
30
"scaleAnswerPercentage": 25
31
},
32
{
33
"booleanAnswer": false,
34
"scaleAnswer": null,
35
"textAnswer": null,
36
"comment": "Yard consumer subject plant every than education life.",
37
"scaleAnswerPercentage": null
38
}
39
],
40
"givers": [
41
{
42
"email": "[email protected]"
43
}
44
],
45
"receivers": [
46
{
47
"email": null
48
}
49
]
50
}
51
},
52
{
53
"node": {
54
"createdAt": "2021-02-03T00:06:20.095326",
55
"modifiedAt": "2021-02-03T00:06:20.095335",
56
"answers": [
57
{
58
"booleanAnswer": null,
59
"scaleAnswer": null,
60
"textAnswer": "Some awesome answer for question \"Question of type Text\" (a17d3ff4-25ac-4f15-bfde-8422112cf072) Author easy herself treat budget majority recently theory onto argue foreign win situation shake sense certain opportunity coach picture family picture attack almost short should discover allow down while picture finish every tree watch across above consumer audience after building environmental look second identify live challenge edge establish why lawyer that white customer market idea our local when rich television still indeed seek investment ever attorney analysis why about major everybody culture expect what wonder.",
61
"comment": null,
62
"scaleAnswerPercentage": null
63
},
64
{
65
"booleanAnswer": null,
66
"scaleAnswer": 4,
67
"textAnswer": null,
68
"comment": null,
69
"scaleAnswerPercentage": 100
70
},
71
{
72
"booleanAnswer": true,
73
"scaleAnswer": null,
74
"textAnswer": null,
75
"comment": "In including wonder policy some piece scientist.",
76
"scaleAnswerPercentage": null
77
}
78
],
79
"givers": [
80
{
81
"email": "[email protected]"
82
}
83
],
84
"receivers": [
85
{
86
"email": null
87
}
88
]
89
}
90
}
91
]
92
}
93
}
94
}
95
}
Copied!
Pass the first page's endCursor into first:
1
{
2
activity(id: "5572112e-66ad-45de-bd83-1332df79f51c") {
3
... on TeacherReviewActivity {
4
title
5
activityType
6
reviews(first: 2, after: "YXJyYXljb25uZWN0aW9uOjE=") {
7
pageInfo {
8
hasPreviousPage
9
hasNextPage
10
endCursor
11
}
12
edges {
13
node {
14
createdAt
15
modifiedAt
16
answers {
17
booleanAnswer
18
scaleAnswer
19
textAnswer
20
comment
21
scaleAnswerPercentage
22
}
23
givers {
24
email
25
}
26
receivers {
27
email
28
}
29
}
30
}
31
}
32
}
33
}
34
}
35
Copied!
    Begins directly on the second page
    hasPreviousPage is now true
    New endCursor is YXJyYXljb25uZWN0aW9uOjM=, let's use it on Page 3:
1
{
2
"data": {
3
"activity": {
4
"title": "Flow 1 - Activity 5 - Teacher's Perspective",
5
"activityType": "TeacherReview",
6
"reviews": {
7
"pageInfo": {
8
"hasPreviousPage": true,
9
"hasNextPage": true,
10
"endCursor": "YXJyYXljb25uZWN0aW9uOjM="
11
},
12
"edges": [
13
{
14
"node": {
15
"createdAt": "2021-02-03T09:12:20.137659",
16
"modifiedAt": "2021-02-03T09:12:20.137664",
17
"answers": [
18
{
19
"booleanAnswer": null,
20
"scaleAnswer": null,
21
"textAnswer": "Some awesome answer for question \"Question of type Text\" (a17d3ff4-25ac-4f15-bfde-8422112cf072) Be station board find own rest either agreement account report investment personal form information fall rise guess site local father attorney season argue call along Congress crime watch again watch decide method mean leader because plan decision audience tonight kitchen by box carry serve we look who realize focus check create newspaper next room either event every business box section cup feel father direction college difficult garden computer production should side decision force issue send challenge return debate force production half lawyer walk inside positive that beautiful allow response land.",
22
"comment": null,
23
"scaleAnswerPercentage": null
24
},
25
{
26
"booleanAnswer": null,
27
"scaleAnswer": 4,
28
"textAnswer": null,
29
"comment": null,
30
"scaleAnswerPercentage": 100
31
},
32
{
33
"booleanAnswer": true,
34
"scaleAnswer": null,
35
"textAnswer": null,
36
"comment": "Reflect leader understand another management.",
37
"scaleAnswerPercentage": null
38
}
39
],
40
"givers": [
41
{
42
"email": "[email protected]"
43
}
44
],
45
"receivers": [
46
{
47
"email": null
48
}
49
]
50
}
51
},
52
{
53
"node": {
54
"createdAt": "2021-02-03T00:06:20.179206",
55
"modifiedAt": "2021-02-03T00:06:20.179212",
56
"answers": [
57
{
58
"booleanAnswer": null,
59
"scaleAnswer": null,
60
"textAnswer": "Some awesome answer for question \"Question of type Text\" (a17d3ff4-25ac-4f15-bfde-8422112cf072) Feel artist star determine family trouble man enjoy turn medical list mouth itself together sense along than authority bag skin check simply heart assume issue by office though community read trial since success you TV worry your stuff security office provide oil push treatment area these early discussion even treatment general hope whole enjoy financial talk after health kitchen ready region area support meet next consumer federal street section traditional him garden crime anything ready thought western sometimes line chance nor anything can thing sense before available view us both attack lay show information form wind memory main program center rock value sense personal.",
61
"comment": null,
62
"scaleAnswerPercentage": null
63
},
64
{
65
"booleanAnswer": null,
66
"scaleAnswer": 4,
67
"textAnswer": null,
68
"comment": null,
69
"scaleAnswerPercentage": 100
70
},
71
{
72
"booleanAnswer": false,
73
"scaleAnswer": null,
74
"textAnswer": null,
75
"comment": "Five economic affect writer approach white.",
76
"scaleAnswerPercentage": null
77
}
78
],
79
"givers": [
80
{
81
"email": "[email protected]"
82
}
83
],
84
"receivers": [
85
{
86
"email": null
87
}
88
]
89
}
90
}
91
]
92
}
93
}
94
}
95
}
Copied!
This time, for variety, let's just take 1, and return different fields:
1
{
2
activity(id: "5572112e-66ad-45de-bd83-1332df79f51c") {
3
... on TeacherReviewActivity {
4
title
5
activityType
6
reviews(first: 1, after: "YXJyYXljb25uZWN0aW9uOjM=") {
7
pageInfo {
8
endCursor
9
}
10
edges {
11
node {
12
reviewType
13
createdAt
14
modifiedAt
15
answers {
16
scaleAnswerPercentage
17
}
18
givers {
19
email
20
}
21
receivers {
22
email
23
}
24
}
25
}
26
}
27
}
28
}
29
}
30
Copied!
Based on the query being adjust to first: 1, we should only see one item returned in page 3.
    Only shows the fields requested (fields don't need to be the same each time)
    Shows reviewType
    Only shows 1 result, per first
1
{
2
"data": {
3
"activity": {
4
"title": "Flow 1 - Activity 5 - Teacher's Perspective",
5
"activityType": "TeacherReview",
6
"reviews": {
7
"pageInfo": {
8
"endCursor": "YXJyYXljb25uZWN0aW9uOjQ="
9
},
10
"edges": [
11
{
12
"node": {
13
"reviewType": "TeacherReview",
14
"createdAt": "2021-02-03T09:36:20.221437",
15
"modifiedAt": "2021-02-03T09:36:20.221441",
16
"answers": [
17
{
18
"scaleAnswerPercentage": null
19
},
20
{
21
"scaleAnswerPercentage": 125
22
},
23
{
24
"scaleAnswerPercentage": null
25
}
26
],
27
"givers": [
28
{
29
"email": "[email protected]"
30
}
31
],
32
"receivers": [
33
{
34
"email": "[email protected]"
35
}
36
]
37
}
38
}
39
]
40
}
41
}
42
}
43
}
Copied!
The above example moves between 3 pages, passing the endCursor of the previous query into the after of the next page's. The initial (first) page doesn't need any after. The final page alters the fields queried and changes the amount returned.

Bonus: Start at last item and travel backwards

Page 1
Response
Page 2
Response
last: 2 instead of first:
1
{
2
activity(id: "5572112e-66ad-45de-bd83-1332df79f51c") {
3
... on TeacherReviewActivity {
4
title
5
activityType
6
reviews(last: 2) {
7
pageInfo {
8
hasPreviousPage
9
hasNextPage
10
startCursor
11
}
12
edges {
13
node {
14
reviewType
15
createdAt
16
modifiedAt
17
answers {
18
scaleAnswerPercentage
19
}
20
givers {
21
email
22
}
23
receivers {
24
email
25
}
26
}
27
}
28
}
29
}
30
}
31
}
32
Copied!
    Returns 2 items
    Last item
    hasPreviousPage is true
    startCursor of YXJyYXljb25uZWN0aW9uOjQ= will be used in before on the next page
1
{
2
"data": {
3
"activity": {
4
"title": "Flow 1 - Activity 5 - Teacher's Perspective",
5
"activityType": "TeacherReview",
6
"reviews": {
7
"pageInfo": {
8
"hasPreviousPage": true,
9
"startCursor": "YXJyYXljb25uZWN0aW9uOjQ="
10
},
11
"edges": [
12
{
13
"node": {
14
"reviewType": "TeacherReview",
15
"createdAt": "2021-02-03T08:06:20.221437",
16
"modifiedAt": "2021-02-03T08:06:20.221441",
17
"answers": [
18
{
19
"scaleAnswerPercentage": null
20
},
21
{
22
"scaleAnswerPercentage": 125
23
},
24
{
25
"scaleAnswerPercentage": null
26
}
27
],
28
"givers": [
29
{
30
"email": "[email protected]"
31
}
32
],
33
"receivers": [
34
{
35
"email": "[email protected]"
36
}
37
]
38
}
39
},
40
{
41
"node": {
42
"reviewType": "TeacherReview",
43
"createdAt": "2021-02-03T08:06:20.261409",
44
"modifiedAt": "2021-02-03T08:06:20.261414",
45
"answers": [
46
{
47
"scaleAnswerPercentage": null
48
},
49
{
50
"scaleAnswerPercentage": 125
51
},
52
{
53
"scaleAnswerPercentage": null
54
}
55
],
56
"givers": [
57
{
58
"email": "[email protected]"
59
}
60
],
61
"receivers": [
62
{
63
"email": null
64
}
65
]
66
}
67
}
68
]
69
}
70
}
71
}
72
}
Copied!
Since we're moving backwards, we use before:
1
{
2
activity(id: "5572112e-66ad-45de-bd83-1332df79f51c") {
3
... on TeacherReviewActivity {
4
title
5
activityType
6
reviews(last: 2, before: "YXJyYXljb25uZWN0aW9uOjU=") {
7
pageInfo {
8
hasPreviousPage
9
startCursor
10
}
11
edges {
12
node {
13
reviewType
14
createdAt
15
modifiedAt
16
answers {
17
scaleAnswerPercentage
18
}
19
givers {
20
email
21
}
22
receivers {
23
email
24
}
25
}
26
}
27
}
28
}
29
}
30
}
31
Copied!
Continue with cursor
1
{
2
"data": {
3
"activity": {
4
"title": "Flow 1 - Activity 5 - Teacher's Perspective",
5
"activityType": "TeacherReview",
6
"reviews": {
7
"pageInfo": {
8
"hasPreviousPage": true,
9
"startCursor": "YXJyYXljb25uZWN0aW9uOjM="
10
},
11
"edges": [
12
{
13
"node": {
14
"reviewType": "TeacherReview",
15
"createdAt": "2021-02-03T07:06:20.179206",
16
"modifiedAt": "2021-02-03T07:06:20.179212",
17
"answers": [
18
{
19
"scaleAnswerPercentage": null
20
},
21
{
22
"scaleAnswerPercentage": 100
23
},
24
{
25
"scaleAnswerPercentage": null
26
}
27
],
28
"givers": [
29
{
30
"email": "[email protected]"
31
}
32
],
33
"receivers": [
34
{
35
"email": null
36
}
37
]
38
}
39
},
40
{
41
"node": {
42
"reviewType": "TeacherReview",
43
"createdAt": "2021-02-03T07:06:20.221437",
44
"modifiedAt": "2021-02-03T07:06:20.221441",
45
"answers": [
46
{
47
"scaleAnswerPercentage": null
48
},
49
{
50
"scaleAnswerPercentage": 125
51
},
52
{
53
"scaleAnswerPercentage": null
54
}
55
],
56
"givers": [
57
{
58
"email": "[email protected]"
59
}
60
],
61
"receivers": [
62
{
63
"email": "[email protected]"
64
}
65
]
66
}
67
}
68
]
69
}
70
}
71
}
72
}
Copied!

GraphQL Terms

Term
Description
first
For slicing, fetch the items at the beginning
last
For slicing, beginning at last item
after
Accepts a cursor ID of where to continue paginating
cursor
ID of the cursor, in Eduflow, sometimes equal to pageInfo.endCursor
pageInfo
Structure containing cursor location, item count, previous/next page
    startCursor
    endCursor: Use this in the next page's after: to start on next page
    hasPreviousPage
    hasNextPage
edges
List of containing nodes (list of objects) of the connection
node
The object itself, e.g. User, Activity

See also

Last modified 3mo ago
Copy link