Skip to content
Josh Heng edited this page Apr 6, 2021 · 1 revision

GraphQL Queries

Most data (except from tasks) are handled through the GraphQL endpoint

Request

POST request to /_api/1.0/graphql?ffauth_device_id={ device_id }&ffauth_secret={ secret }

  • x-www-form-urlencoded body
    • data: GraphQL query, URL encoded

Queries

Configuration

Request

query Query
{
	configuration {
        week_start_day, weekend_days, native_app_capabilities, notice_group_guid 
    }
}

Response

{
    "data": {
        "configuration": {
            "week_start_day": "Monday",
            "weekend_days": [
                "Saturday",
                "Sunday"
            ],
            "native_app_capabilities": [
                "tasks-updated-since",
                "edit-student-notes",
                "delete-bookmarks",
                "read-messages",
                "mark-read-bookmarks",
                "get-children",
                "mark-read-and-archive-messages",
                "task-assessment-types",
                "send-messages",
                "mark-and-grade-assessment-types",
                "get-tasks-webapi",
                "task-listing-parents",
                "get-student-tasks-webapi",
                "mark-read-all-students-responses",
                "mark-read-tasks-without-responses-student",
                "markbook-inspecting-grades",
                "daily-event-refresh",
                "rubrics-enabled",
                "rubric-mixed-assessment-types",
                "co-owners-enabled",
                "get-task-ids",
                "rubric-levels",
                "parent-portal-enabled"
            ],
            "notice_group_guid": "[[NOTICE_GROUP_GUID]]"
        }
    }
}

App Styles

Request

query Query {
    app_styles {
        value, name, type, file 
    }
}

Response

{
    "data": {
        "app_styles": []
    }
}

General Data (Bookmarks, Classes, Messages, Etc)

Request

query Query {
    users(guid: "[[PUPIL_GUID]]") {
        bookmarks {
            simple_url, deletable, position, read, from {
                guid, name 
            }, type, title, is_form, form_answered, breadcrumb, guid, created 
        }, messages {
            from {
                guid, name 
            }, sent, archived, id, single_to {
                guid, name 
            }, all_recipients, read, body 
        }, classes {
            guid 
        }, children {
            guid, name, sort_key 
        }, participating_in {
            guid, sort_key, name, personal_colour 
        }, is_admin, sent_messages {
            from {
                guid, name 
            }, sent, archived, id, all_recipients, read, body 
        }
    }
}

Response

{
    "data": {
        "users": [
            {
                "bookmarks": [
                    {
                        "simple_url": "/page.aspx?id=000",
                        "deletable": true,
                        "position": 1,
                        "read": "True",
                        "from": {
                            "guid": "[[FROM_USER_GUID]]",
                            "name": "[[FROM_USER_NAME]]"
                        },
                        "type": "Personal",
                        "title": "[[TITLE]]",
                        "is_form": false,
                        "form_answered": false,
                        "breadcrumb": "[[BREADCRUMB]]",
                        "guid": "[[BOOKMARK_ID}}",
                        "created": "[[CREATED_TIMESTAMP]]"
                    },
                    {
                        "simple_url": "/page.aspx?id=00000",
                        "deletable": false,
                        "position": null,
                        "read": "True",
                        "from": {
                            "guid": "[[FROM_USER_GUILD]]",
                            "name": "[[FROM_USER_NAME]]"
                        },
                        "type": "Recommended",
                        "title": "[[TITLE]]",
                        "is_form": false,
                        "form_answered": false,
                        "breadcrumb": "[[BREADCRUMB]]",
                        "guid": "[[BOOKMARK_ID]]",
                        "created": "[[CREATED_TIMESTAMP]]"
                    }
					...
                ],
                "messages": [
                    {
                        "from": {
                            "guid": "[[SENDER_GUID]]",
                            "name": "[[SENDER_NAME]]"
                        },
                        "sent": "[[SENT_TIMESTAMP]]",
                        "archived": true,
                        "id": [[MESSAGE_ID]],
                        "single_to": {
                            "guid": "[[RECIPIENT/GROUP_GUID]]",
                            "name": "[[RECIPIENT/GROUP_NAME]]"
                        },
                        "all_recipients": "[[ALL_RECIPIENTS_STRING]]",
                        "read": true,
                        "body": "[[MESSAGE_BODY]]"
                    },
                    ...
                ],
                "classes": [],
                "children": [],
                "participating_in": [
                    {
                        "guid": "[[GROUP_GUID]]",
                        "sort_key": "[[GROUP_SORTING_KEY]]",
                        "name": "[[GROUP_NAME]]",
                        "personal_colour": "[[GROUP_COLOUR]]"
                    }
                    ...
                ],
                "is_admin": false,
                "sent_messages": []
            }
        ]
    }
}
  • [[ALL_RECIPIENTS_STRING]] is a string containing the list of recipients of the message. It may just be "" if recipients are hdiden

Timetable/Events

Request

query Query {
    events(start: "[[EVENTS_START]]", for_guid: "[[PUPIL_GUID]]", end: "[[EVENTS_END]]") {
        end, location, start, subject, description, guid, attendees {
            role, principal {
                guid, name 
            }
        }
    }
}
  • [[EVENTS_START]] - ISO 8601 timestamp of when events should start. Example - 2020-09-01T00:00:00Z
  • [[EVENTS_END]] - ISO 8601 timestamp of when events should start. Example - 2021-09-01T00:00:00Z
  • [[PUPIL_GUID]] - GUID of pupil to fetch the timetable for. Example - DB:Cloud:DB:iSAMSstu:0000

Response

{
    "data": {
        "events": [
            {
                "end": "[[END ISO8601 TIMESTAMP]]",
                "location": "[[LOCATION]]",
                "start": "[[START ISO8601 TIMESTAMP]]",
                "subject": "[[SUBJECT_NAME]]",
                "description": "[[SUBJECT_DESCRIPTION/CLASS NAME]]",
                "guid": "[[GUID]]",
                "attendees": [
                    {
                        "role": "Chairperson",
                        "principal": {
                            "guid": "[[TEACHER_GUID]]",
                            "name": "[[TEACHER_NAME]]"
                        }
                    },
                    {
                        "role": "Required",
                        "principal": {
                            "guid": "[[CLASS_GUID]]",
                            "name": "[[CLASS_NAME]]"
                        }
                    }
                ]
            },
			...
		]
	}

Groups

  • NOTE: Couldn't get working

Request

query Query {
    groups(guids: ["[[GROUP_GUID]]"]) {
        guid, sort_key, name, members {
            targets(for_guid: "[[PUPIL_GUID]]") {
                target 
            }, principal {
                evaluated_role, sort_key, name, guid 
            }

        }, personal_colour 
    }
}

Response

{
    "data": {
        "groups": []
    }
}

Mutations

Set Personal Task

Request

mutation M {
    result: tasks(
		new_pseudo_to: "[[CLASS_GUID]]",
		new_draft: false, 
		new_set: "[[SET_DATE]]",
		new_highlight_in_markbook: false,
		new_description: "[[DESCRIPTION]]",
		new_archive: false,
		new_addressees: ["[[RECIPIENT_GUID]]"],
		new_markbook_displaymode: "Auto",
		new_file_submission_required: false,
		new_task_type: "PersonalTask",
		new_show_in_markbook: true,
		new_hide_addressees: true,
		new_title: [[TITLE]],
		new_setter: "[[SETTER_GUID]]",
		new: true,
		new_pseudo_from: "",
		new_parentportal_visible: false,
		new_due: "[[DUE_DATE]]",
		new_hide_from_recipients: false
	) {
        id, assessment_details_id 
    }
}
  • [[SET_DATE]] and [[DUE_DATE]]`` are in the format 2020-01-01`

Response

{
    "data": {
        "result": [
            {
                "id": [[TASK_ID]],
                "assessment_details_id": 0
            }
        ]
    }
}

Archive Message

Request

mutation M {
    result: messages(ids: [{{MESSAGE_ID}}], user_guid: "[[PUPIL_GUID]]", new_archive: 1) {
        from {
            guid, name 
        }, sent, archived, id, single_to {
            guid, name 
        }, all_recipients, read, body 
    }
}

Response

{
    "data": {
        "result": [
            {
                "from": {
                    "guid": "[[FROM_GUID]]",
                    "name": "[[FROM_NAME]]"
                },
                "sent": "[[SENT_TIMESTAMP]]",
                "archived": true,
                "id": [[MESSAGE_ID]],
                "single_to": {
                    "guid": "[[RECIPIENT/GROUP_GUID]]",
                    "name": "[[RECIPIENT/GROUP_NAME]]"
                },
                "all_recipients": "[[MESSAGE_RECIPIENTS_STRING]]",
                "read": true,
                "body": "[[MESSAGE_BODY]]"
            }
        ]
    }
}

Move Message To Inbox

Request

mutation M {
    result: messages(ids: [{{MESSAGE_ID}}], user_guid: "[[PUPIL_GUID]]", new_archive: 0) {
        from {
            guid, name 
        }, sent, archived, id, single_to {
            guid, name 
        }, all_recipients, read, body 
    }
}

Response

{
    "data": {
        "result": [
            {
                "from": {
                    "guid": "[[FROM_GUID]]",
                    "name": "[[FROM_NAME]]"
                },
                "sent": "[[SENT_TIMESTAMP]]",
                "archived": false,
                "id": [[MESSAGE_ID]],
                "single_to": {
                    "guid": "[[RECIPIENT/GROUP_GUID]]",
                    "name": "[[RECIPIENT/GROUP_NAME]]"
                },
                "all_recipients": "[[MESSAGE_RECIPIENTS_STRING]]",
                "read": true,
                "body": "[[MESSAGE_BODY]]"
            }
        ]
    }
}