API documentation

Endpoint

All requests to the external API are made through a single endpoint:

https://YOUR-SITE-URL/api/graphql.php

Requests are made via the HTTP POST method with a JSON-encoded body:

$ curl 'https://YOUR-SITE-URL/api/graphql.php' \
    -X POST \
    -H 'Authorization: Bearer YOUR-API-BEARER-TOKEN' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    --data-binary '{ "query": "query { totara_webapi_status { status } }", "variables": "{}" }'

See the Authentication section below for how to obtain a valid Bearer token.

The expected response for this request would be the following JSON object:

{
  "data": {
    "totara_webapi_status": {
      "status": "ok"
    }
  }
}

Authentication

The external API uses OAuth 2.0 via the client credentials grant type to authenticate requests. This involves three steps as outlined below.

1. Register a client

To register a client, log in to your Totara site and navigate to 'API Clients'.

Click the Add client button and provide information to describe the purpose of your client.

Make a note of the client id and secret for step 2.

2. Request a token

To programmatically request a token, call the OAuth 2.0 token endpoint as follows, passing the client_id and client_secret obtained during step 1:

curl -X POST 'https://YOUR-SITE-URL/totara/oauth2/token.php' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=CLIENT_ID_HERE&client_secret=CLIENT_SECRET_HERE'

The response will be:

{
  "token_type": "Bearer",
  "expires_in": 3600,
  "access_token": "YOUR-API-BEARER-TOKEN"
}

3. Submit a request with a valid token

Copy the value from the "access_token" property in the response into the 'Authorization: Bearer' header of your request.

Request format

A simple GraphQL request might look like this:

query my_query {
  totara_webapi_status {
    status
  }
}

This request consists of the following.

The query keyword

This indicates this is a read-only request. 'mutation' is used for requests which write data. The keyword is optional, but when provided the specific actions within the request must match the keyword given.

Request name (my_query)

Optional string to allow the request author to describe the purpose of the request. It is not used by the server.

Query or mutation name (totara_webapi_status)

Within the outer curly braces you must specify at least one query or mutation to execute (typically just one but requesting multiple is allowed).

The available queries and mutations are specified in the reference documentation.

Response structure

In GraphQL it is up to the query author to specify the data they want to receive in the response.

The curly braces and field names within them specify the data structure. They must match the structure of the type that is returned by that query or mutation.

Types can be complex (contain properties that represent other types), so additional curly braces are used to obtain properties of subresources in one request. For example, to get a list of course names and the name of each course's category:

query get_courses {
  get_courses {
    fullname
    category {
      name
    }
  }
}

Arguments and variables

Some queries and mutations have optional or required arguments which require additional data to be passed with the request.

User-provided data is kept separate from the body of the request as variables. Variables are passed as a separate JSON object with the query. To make use of variables, the structure of the query changes slightly:

Query

query get_course($courseid: core_id!) {
  core_course(courseid: $courseid) {
    fullname
  }
}

Variables

{
  "courseid": 2
}

In this example the ‘core_course’ query has an argument 'courseid'. It must be of the type 'core_id' and it is required (the ! suffix is used when a field must be provided). Available arguments are listed in the reference documentation for a query or mutation. Although values can also be hardcoded in the query, it is good practice to use variables to support argument validation and query reuse.

Variables are represented by strings starting with the dollar sign ($). Any $variable specified within the body of the request must be defined in the round brackets after the outer query name. When defining a variable you must specify its type. Variables will be validated according to their type before query execution. Complex types (types with properties made of other types) are allowed but must be defined in the schema.

The variables object that is passed with the request must have keys that match the variable names and give values that are compatible with the specified type for that variable.

Field arguments

Like queries and mutations, fields can support arguments. For example, here the argument on the timestamp field determines how the field is formatted in the response:

query test {
 totara_webapi_status {
   status
   timestamp(format: DATETIMELONG)
  }
}

Aliases

You can prefix a query, mutation or field with a different name and the server will return it as the key you specify. This can be used to return data to match a certain structure, or to differentiate if you are requesting the same field multiple times.

query test {
  my_query_name: totara_webapi_status {
    status
    long_year: timestamp(format: DATETIMELONG)
    short_year: timestamp(format: DATETIMESHORT)
  }
}

would return:

{
  "data": {
    "my_query_name": {
      "status": "ok",
      "long_year": "27/05/2022, 10:51",
      "short_year": "27/05/22, 10:51"
    }
  }
}

For more information on the GraphQL language see this Introduction to GraphQL.

API schema

You can perform introspection against the external API directly.

Alternatively, you can download the current external API schema for your site here: https://YOUR-SITE-URL/totara/api/documentation/schema.php

Core

Queries

core_course_courses

Description

Retrieve a paginated list of all available courses. Note that in order to see a full list of course activities, the API user must have the capability to view those activities e.g. mod/scorm:view, mod/quiz:view, ...

Response

Returns a core_course_courses_result!

Arguments
Name Description
query - core_course_courses_query The query parameter contains pagination and sorting information.

Example

Query
query core_course_courses($query: core_course_courses_query) {
  core_course_courses(query: $query) {
    items {
      ...core_courseFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": core_course_courses_query}
Response
{
  "data": {
    "core_course_courses": {
      "items": [core_course],
      "total": 987,
      "next_cursor": "abc123"
    }
  }
}

core_course_is_user_enrolled

Description

Query to check whether the user is enrolled a course.

Arguments
Name Description
course - core_course_course_reference! Target course.
user - core_user_user_reference! Target user.

Example

Query
query core_course_is_user_enrolled(
  $course: core_course_course_reference!,
  $user: core_user_user_reference!
) {
  core_course_is_user_enrolled(
    course: $course,
    user: $user
  ) {
    user_currently_enrolled
  }
}
Variables
{
  "course": core_course_course_reference,
  "user": core_user_user_reference
}
Response
{"data": {"core_course_is_user_enrolled": {"user_currently_enrolled": true}}}

Types

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

Float

Description

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Example
987.65

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
987

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"xyz789"

core_category

Description

A single category. Categories are a hierarchical structure which contain learning items such as courses.

Fields
Field Name Description
id - core_id! Category ID.
name - String! Category name.
Arguments
format - core_format
idnumber - String Category idnumber
description - String Category description
Arguments
format - core_format
descriptionformat - core_format The format of the categories description
full_path - String The displayable path of the category. I.e. "Grandparent Cat1 / Parent Cat2 / This Cat 3"
Arguments
format - core_format
parent - core_category Parent category this category is inside, or null for top level categories.
children - [core_category!]! Sub-categories that are inside this category.
depth - Int Depth of this category in the tree. One means top-level category, add one for each level below that.
courses - [core_course!]! Courses that are inside this category.
coursecount - Int! Number of courses in this category (not including courses in sub-categories).
timemodified - core_date
Arguments
format - core_date_format
theme - String Force theme used in category, or null if not overridden in category.
Example
{
  "id": 4,
  "name": "abc123",
  "idnumber": "xyz789",
  "description": "xyz789",
  "descriptionformat": "RAW",
  "full_path": "abc123",
  "parent": core_category,
  "children": [core_category],
  "depth": 123,
  "courses": [core_course],
  "coursecount": 987,
  "timemodified": "2022-04-17",
  "theme": "abc123"
}

core_course

Description

A single course object. Courses are containers for a collection of activities that make up a unit of learning.

Fields
Field Name Description
id - core_id! ID of the course
idnumber - String Course idnumber
fullname - String! Course fullname
Arguments
format - core_format
shortname - String! Course shortname
Arguments
format - core_format
summary - String Course summary
Arguments
format - core_format
summaryformat - core_format The format of the courses summary
timecreated - core_date The date/time the course was created
Arguments
format - core_date_format
timemodified - core_date The date/time the course was last modified
Arguments
format - core_date_format
category - core_category Category this course is in, or null for the frontpage course.
categoryid - core_id ID of this course's category, or zero for the frontpage course.
startdate - core_date Course start date
Arguments
format - core_date_format
enddate - core_date Course end date
Arguments
format - core_date_format
theme - String Force theme used in course, or null if not overridden in course.
lang - String Force language used in course, or null if language not overridden in course.
format - String Course format.
coursetype - Int Course type values are integers matching TOTARA_COURSE_TYPE_* constants defined in course/lib.php.
icon - String Name of course icon used to represent the course, or 'default' if no icon has been set.
image - String A URL for the course image
sections - [core_course_section!]! Course sections/topics/weeks
modcount - Int The number of modules in the course accessible to the user.
showgrades - Boolean! The showgrades (show gradebook to learners) flag for the course
completionenabled - Boolean! The enablecompletion (enable completion tracking) flag for the course
completion - core_course_completion The completion information relating to the course and current user
criteria - [core_course_criteria]! The completion criteria for the course, and associated completion info for the current user
criteriaaggregation - String The aggregation method for the overall course criteria
url - String! Course view url.
course_format - core_course_format! The course's format metadata information.
tags - [core_tag] The tags applied to a course.
custom_fields - [totara_customfield_field!] The custom fields associated with a course.
Example
{
  "id": 4,
  "idnumber": "abc123",
  "fullname": "xyz789",
  "shortname": "xyz789",
  "summary": "abc123",
  "summaryformat": "RAW",
  "timecreated": "2022-04-17",
  "timemodified": "2022-04-17",
  "category": core_category,
  "categoryid": 4,
  "startdate": "2022-04-17",
  "enddate": "2022-04-17",
  "theme": "xyz789",
  "lang": "xyz789",
  "format": "abc123",
  "coursetype": 987,
  "icon": "xyz789",
  "image": "abc123",
  "sections": [core_course_section],
  "modcount": 987,
  "showgrades": true,
  "completionenabled": true,
  "completion": core_course_completion,
  "criteria": [core_course_criteria],
  "criteriaaggregation": "xyz789",
  "url": "abc123",
  "course_format": core_course_format,
  "tags": [core_tag],
  "custom_fields": [totara_customfield_field]
}

core_course_completion

Description

A single course completion object. A completion object tracks the status of a specific user in a specific course.

Fields
Field Name Description
id - Int The id of the completion record, however this can be null if not started or not enrolled.
status - String A string representing the current learner's completion state in a course
statuskey - String A string used as a get_string key for a longer completion status description
Arguments
format - core_format
progress - Float A percentage describing how far the user has progressed through this course
timecompleted - core_date The time the user completed this course
Arguments
format - core_date_format
gradefinal - Float The user's grade in the course as an absolute value
grademax - Float The maximum achievable grade for the course
gradepercentage - Float The user's grade in the course as a percentage of grademax
Example
{
  "id": 123,
  "status": "abc123",
  "statuskey": "xyz789",
  "progress": 123.45,
  "timecompleted": "2022-04-17",
  "gradefinal": 123.45,
  "grademax": 987.65,
  "gradepercentage": 123.45
}

core_course_course_reference

Description

Input for identifying a course.

The course must be specified by providing one of the following:

  • The course's internal database id
  • The course's idnumber
  • The course's shortname
Fields
Input Field Description
id - core_id

Internal database id of the course.

shortname - String

Shortname of the course.

idnumber - String

The id number of the course.

Example
{
  "id": 4,
  "shortname": "xyz789",
  "idnumber": "xyz789"
}

core_course_courses_filters

Description

Input type used when querying for a list of courses. Specifies filters to be applied to the results.

Fields
Input Field Description
since_timecreated - core_date

Unix creation timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

since_timemodified - core_date

Unix timemodification timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

tag_filter - String

Raw name of a tag.

Example
{
  "since_timecreated": "1696837540",
  "since_timemodified": "1696837540",
  "tag_filter": "education"
}

core_course_courses_query

Description

Input type for retrieving the list of all available courses. The query parameter includes pagination and sorting information for organising results.

Fields
Input Field Description
pagination - core_pagination_input

The pagination object contains information about the number of items to be returned, and the page offset to start from.

sort - [core_sort_input!]

The sort order for the query. The query is currently only able to sort by one order.

filters - core_course_courses_filters

The filters for querying course.

Example
{
  "pagination": core_pagination_input,
  "sort": [core_sort_input],
  "filters": core_course_courses_filters
}

core_course_courses_result

Description

The result of the courses query.

Fields
Field Name Description
items - [core_course]! A list of vector course items.
total - Int! The number of returned courses.
next_cursor - String! The cursor indicates where the returned result ends, and where the next query should begin.
Example
{
  "items": [core_course],
  "total": 123,
  "next_cursor": "xyz789"
}

core_course_criteria

Description

A single course criteria object. Criteria define the rules that determine whether a user has completed a course or activity.

Fields
Field Name Description
id - core_id! The id of the course module
type - String The type of the criteria
typeaggregation - String The aggregation used for this criteria type grouping
Arguments
format - core_format
criteria - String The name or descriptor of the criteria
Arguments
format - core_format
requirement - String What needs to be done to complete the criteria
Arguments
format - core_format
status - String How far the user is through the requirement
Arguments
format - core_format
complete - Boolean Whether the current user has completed the criteria
completiondate - core_date The date the current user completed the criteria
Arguments
format - core_date_format
Example
{
  "id": 4,
  "type": "xyz789",
  "typeaggregation": "xyz789",
  "criteria": "abc123",
  "requirement": "abc123",
  "status": "abc123",
  "complete": true,
  "completiondate": "2022-04-17"
}

core_course_format

Description

GraphQL type for the course's format.

Fields
Field Name Description
format - String!

The type name of course format, which can be any of the course's format plugin names. For example it can be any of the following:

  • topics
  • singleactivity
  • demo
  • none
name - String! A human-readable label for the course format.
has_course_view_page - Boolean! Flag to identify whether the course format supports the course view page or not.
Example
{
  "format": "xyz789",
  "name": "xyz789",
  "has_course_view_page": true
}

core_course_is_user_enrolled_result

Description

Result object for query 'core_course_is_user_enrolled_result'.

Fields
Field Name Description
user_currently_enrolled - Boolean! Whether the user is enrolled a course.
Example
{"user_currently_enrolled": true}

core_course_module

Description

A single course activity module. Activities are individual pieces of learning within a course.

Fields
Field Name Description
id - core_id! The id of the course module
idnumber - String The idnumber of the course module
Arguments
format - core_format
instanceid - core_id! The id in the instance, e.g. the id of the scorm in the scorm table
modtype - String! The type of the module (assignment, quiz, etc)
Arguments
format - core_format
name - String! The name of the course module
Arguments
format - core_format
viewurl - String The view url of the course module
Arguments
format - core_format
completion - String The completion settings of the course module
completionenabled - Boolean! Whether completion is enabled or not for the course module
completionstatus - String The completion status of the current user in the course module
rpl - Boolean The rpl completion status of the current user in the course module
progress - Int The percentage completion progress of the current user in the course module
available - Boolean! Whether the course module is available for the current user
availablereason - [String]! The reason for the course module not being available to the current user
Arguments
format - core_format
visible - Boolean! Whether the module is visible to the viewing user
showdescription - Boolean Whether the course module displays the description or not
description - String The description of the course module
Arguments
format - core_format
descriptionformat - core_format The format of the description field.
gradefinal - Float The user's grade in the course as an absolute value
grademax - Float The maximum achievable grade for the course
gradepercentage - Float The user's grade in the course as a percentage of grademax
downloadable - Boolean Whether the activity supports download or not for mobile
downloadsize - Int Activity download total size for mobile
Example
{
  "id": 4,
  "idnumber": "abc123",
  "instanceid": 4,
  "modtype": "abc123",
  "name": "xyz789",
  "viewurl": "abc123",
  "completion": "abc123",
  "completionenabled": true,
  "completionstatus": "abc123",
  "rpl": true,
  "progress": 123,
  "available": true,
  "availablereason": ["xyz789"],
  "visible": true,
  "showdescription": true,
  "description": "xyz789",
  "descriptionformat": "RAW",
  "gradefinal": 123.45,
  "grademax": 123.45,
  "gradepercentage": 987.65,
  "downloadable": true,
  "downloadsize": 987
}

core_course_section

Description

A single course section. Courses contain named sections to organise a set of activities.

Fields
Field Name Description
id - core_id! Course section id
title - String Title of the course section
Arguments
format - core_format
modules - [core_course_module] The course modules in the section
available - Boolean! Whether the course section is available to the viewing user
availablereason - [String] The reason why the course section is not available to the viewing user. It will be empty if the course section is available.
Arguments
format - core_format
visible - Boolean! Whether the course section is visible to the viewing user
summary - String The summary of the course section
Arguments
format - core_format
summaryformat - core_format
Example
{
  "id": 4,
  "title": "abc123",
  "modules": [core_course_module],
  "available": true,
  "availablereason": ["abc123"],
  "visible": true,
  "summary": "xyz789",
  "summaryformat": "RAW"
}

core_date

Description

Represents standard unix timestamps stored in database.

For input, use either an integer timestamp, numeric string or an ISO-8601 string.

Output can usually be selected via format argument. See core_date_format enum for the list of supported formats.

Example
"2022-04-17"

core_date_format

Description

List of supported output formats for core_date scalar.

The actual format used for userdate() is: get_string('strftime' . strtolower($arg['format']), 'langconfig')

Values
Enum Value Description

TIMESTAMP

A standard UNIX timestamp value. 0 will be replaced with null.

ISO8601

ISO-8601 time string in current user timezone, null if no date. Example output: 2022-09-01T12:06:53+1200

DAYDATETIME

Datetime string in the format: Thursday, 1 September 2022, 12:05 PM

TIME

Time string in the format: 12:08 PM

TIMESHORT

Time string in the format: 12:08

DATE

Date string in the format: 1 September 2022

DATESHORT

Date string in the format: 1 September

DATELONG

Date string in the format: 1/09/2022

DATETIME

Datetime string in the format: 1 September 2022, 12:12 PM

DATETIMESHORT

Datetime string in the format: 1/09/22, 12:12

DATETIMELONG

Datetime string in the format: 1/09/2022, 12:10

DATETIMESECONDS

Datetime string in the format: 1 Sep 2022 at 12:12:07
Example
"TIMESTAMP"

core_format

Description

Rich-text output format. Note that some rich-text formats may not be renderable in other formats.

Values
Enum Value Description

RAW

Outputs the stored value unchanged. Most commonly used when editing a value.

HTML

Outputs the stored value for display within an HTML page. Handles escaping of HTML entities.

PLAIN

Outputs the stored value in a way suitable for plain-text display.

MARKDOWN

Outputs the stored value in Markdown format.

JSON_EDITOR

Outputs the stored value in a JSON structure, suitable for use by a compatible JSON editor (e.g. Weka).

MOBILE

Outputs the stored value in a format suitable for use within the Totara mobile app.
Example
"RAW"

core_id

Description

Represents database id fields (numeric string). 0 is converted to NULL.

Example
4

core_pageable_result

Description

Represents a result that is broken up into 'pages' returning a subset of the data, an overall total record count plus the next cursor containing the information needed to load the next page.

Fields
Field Name Description
total - Int! Total number of records returned by the request (not the number returned in this result/page, but the overall count).
next_cursor - String! Opaque string containing information to allow the system to identify the next set of results that should be returned after this one. This value can be passed into a query that uses core_pagination_input to fetch the next page.
Example
{"total": 84, "next_cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319"}

core_pagination_input

Description

Contains pagination information needed to load the next page of a query. Note this input type supports both cursor-based and offset-based (page-based) pagination. The method to use will depend on the implementation by the query.

Fields
Input Field Description
cursor - String

Next cursor. Opaque string obtained from the next_cursor property of core_pageable_result. Used by the query to identify which records to return.

limit - param_integer

Number of items to return.

page - param_integer

Page number (only used by offset-based cursors).

Example
{"cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319", "limit": 20, "page": 3}

core_role

Description

Role type object, containing information about a role.

Fields
Field Name Description
id - core_id! Internal database id of the role.
name - String Name of a role.
shortname - String! Shortname of a role.
description - String Description of a role.
Example
{
  "id": 9,
  "name": "student",
  "shortname": "student",
  "description": "It's description of a student role."
}

core_role_role_reference

Description

Input for identifying a role.

The role must be specified by providing one of the following:

  • The role's internal database id
  • The role's shortname

A role reference must uniquely identify a single role to be valid.

Fields
Input Field Description
id - core_id

The internal id for the role

shortname - String

The shortname for the role

Example
{"id": 5, "shortname": "learner"}

core_sort_direction_enum

Description

Options available when specifying the direction of a sort.

Values
Enum Value Description

ASC

Sort column in ascending order. This refers to 0, 1, 2, 3 for numbers and A, B, C, D for strings.

DESC

Sort column in descending order. This refers to 3, 2, 1, 0 for numbers and D, C, B, A for strings.
Example
"ASC"

core_sort_input

Description

Input type for specifying sorting of arbitrary data.

Fields
Input Field Description
column - String!

String containing either a single field or a comma-separated list of fields to be sorted by. Allowed fields are defined in the specific data provider and should be documented in the query, but typically column options will align with existing type field names.

direction - core_sort_direction_enum

The sort direction of the column or columns.

Example
{"column": "timemodified", "direction": "ASC"}

core_text_format

Description

Multiline plain-text (textarea) output format.

Values
Enum Value Description

RAW

Outputs the stored value unchanged. Most commonly used when editing a value.

HTML

Outputs the stored value for display within an HTML page. Handles escaping of HTML entities.

PLAIN

Outputs the stored value in a way suitable for plain text display.

MOBILE

Outputs the stored value in a format suitable for use within the Totara mobile app.
Example
"RAW"

param_alphaext

Description

Input parameter equivalent to PARAM_ALPHAEXT.

Example
"Ab_cd-e"

param_alphanumext

Description

Input parameter equivalent to PARAM_ALPHANUMEXT.

Example
"Abc_123-0"

param_email

Description

Input parameter equivalent to PARAM_EMAIL, '' is converted to NULL.

Example
"test@example.com"

param_integer

Description

Input parameter equivalent to PARAM_INT, '' is converted to NULL.

Example
123

param_text

Description

Input parameter equivalent to PARAM_TEXT.

Example
"This is a string"

param_username

Description

Input parameter equivalent to PARAM_USERNAME, '' is converted to NULL.

Example
"testuser"

Audience

Queries

core_cohort_is_user_member

Description

Return result that indicates the user is the member of the audience.

Arguments
Name Description
user - core_user_user_reference! Target user who is the member of the audience.
cohort - core_cohort_cohort_reference! Target audience.

Example

Query
query core_cohort_is_user_member(
  $user: core_user_user_reference!,
  $cohort: core_cohort_cohort_reference!
) {
  core_cohort_is_user_member(
    user: $user,
    cohort: $cohort
  ) {
    user_is_member
  }
}
Variables
{
  "user": core_user_user_reference,
  "cohort": core_cohort_cohort_reference
}
Response
{"data": {"core_cohort_is_user_member": {"user_is_member": true}}}

core_cohort_static_cohorts

Description

Return a paginated list of static audiences in the system.

Arguments
Name Description
query - core_cohort_static_cohorts_query Sort and pagination information to control the data returned.

Example

Query
query core_cohort_static_cohorts($query: core_cohort_static_cohorts_query) {
  core_cohort_static_cohorts(query: $query) {
    items {
      ...core_cohortFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": core_cohort_static_cohorts_query}
Response
{
  "data": {
    "core_cohort_static_cohorts": {
      "items": [
        {
          "id": "3",
          "name": "Avengers",
          "description": "Description",
          "idnumber": "AUD0001",
          "type": "STATIC",
          "members_count": 2,
          "tags": {"rawname": "Education", "name": "education"}
        },
        {
          "id": "4",
          "name": "Math team",
          "description": "Math team description",
          "idnumber": "AUD0002",
          "type": "STATIC",
          "members_count": 3,
          "tags": {"rawname": "Education", "name": "education"}
        }
      ],
      "total": 47,
      "next_cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319"
    }
  }
}

Mutations

core_cohort_add_cohort_member

Description

Add a given user to a target audience.

Arguments
Name Description
user - core_user_user_reference! Target user who will be added to the audience.
cohort - core_cohort_cohort_reference! The audience to which the user should be added.

Example

Query
mutation core_cohort_add_cohort_member(
  $user: core_user_user_reference!,
  $cohort: core_cohort_cohort_reference!
) {
  core_cohort_add_cohort_member(
    user: $user,
    cohort: $cohort
  ) {
    user {
      ...core_userFragment
    }
    cohort {
      ...core_cohortFragment
    }
    success
    was_already_member
  }
}
Variables
{
  "user": core_user_user_reference,
  "cohort": core_cohort_cohort_reference
}
Response
{
  "data": {
    "core_cohort_add_cohort_member": {
      "user": core_user,
      "cohort": core_cohort,
      "success": true,
      "was_already_member": true
    }
  }
}

core_cohort_remove_cohort_member

Description

Remove a given member from a target audience.

Arguments
Name Description
user - core_user_user_reference! Target user who will be removed from the audience.
cohort - core_cohort_cohort_reference! The audience from which to remove the user.

Example

Query
mutation core_cohort_remove_cohort_member(
  $user: core_user_user_reference!,
  $cohort: core_cohort_cohort_reference!
) {
  core_cohort_remove_cohort_member(
    user: $user,
    cohort: $cohort
  ) {
    user {
      ...core_userFragment
    }
    cohort {
      ...core_cohortFragment
    }
    success
    user_was_member
  }
}
Variables
{
  "user": core_user_user_reference,
  "cohort": core_cohort_cohort_reference
}
Response
{
  "data": {
    "core_cohort_remove_cohort_member": {
      "user": core_user,
      "cohort": core_cohort,
      "success": true,
      "user_was_member": true
    }
  }
}

Types

core_cohort

Description

Audience type object, containing information about an audience.

Fields
Field Name Description
id - core_id! Internal database id of the audience.
name - String! Audience name.
Arguments
format - core_format
idnumber - String The id number of the audience.
Arguments
format - core_format
description - String Audience description.
Arguments
format - core_format
type - core_cohort_type! Audience type.
active - Boolean! Whether the audience is active.
members_count - Int! The number of audience members.
tags - [core_tag]! The tags of static cohorts.
Example
{
  "id": "2",
  "name": "Math team",
  "idnumber": "AUD0002",
  "description": "Math team description",
  "type": "STATIC",
  "active": true,
  "members_count": "5",
  "tags": [core_tag]
}

core_cohort_add_cohort_member_result

Description

The result of the add_cohort_member mutation. This object contains:

  • the user object that was requested
  • the audience object to which the user should be added
  • whether the operation to add the user to the audience was successful
  • whether the user was already a member of the audience Note that if the user was already a member of the selected audience, the 'success' field will be 'False' since the user was not added as a result of this request.
Fields
Field Name Description
user - core_user! User object for the user that is added to the audience.
cohort - core_cohort! Audience object.
success - Boolean! Whether the user is added into audience by this request.
was_already_member - Boolean! Whether the user was already a member of the audience. If so, this operation will technically have failed, but the end result is the same as if it had succeeded.
Example
{
  "user": core_user,
  "cohort": core_cohort,
  "success": true,
  "was_already_member": true
}

core_cohort_cohort_reference

Description

Input for identifying a audience.

The user must be specified by providing one of the following:

  • The audience's internal database id
  • The audience's idnumber
Fields
Input Field Description
id - core_id

Internal database id of the audience.

idnumber - String

The id number of the audience.

Example
{"id": 5, "idnumber": "idnumber5"}

core_cohort_is_user_member_result

Description

Result returned from the core_cohort_is_user_member query.

Fields
Field Name Description
user_is_member - Boolean! Whether the user is the member of the target audience.
Example
{"user_is_member": true}

core_cohort_remove_cohort_member_result

Description

Result returned from the core_cohort_remove_cohort_member mutation. Contains audience information and flags to let you know whether the member was removed from the audience.

Fields
Field Name Description
user - core_user! User object for the user that is removed from the audience.
cohort - core_cohort! Audience object.
success - Boolean! Whether the user was removed from the audience as a result of this request.
user_was_member - Boolean! Whether the user was the member of the audience. If so, this operation will technically have failed, but the end result is the same as if it had succeeded.
Example
{
  "user": core_user,
  "cohort": core_cohort,
  "success": true,
  "user_was_member": true
}

core_cohort_static_cohorts_filter

Description

Input type for filtering static cohorts.

Fields
Input Field Description
tag_filter - String

Raw name of a tag.

since_timecreated - core_date

Unix creation timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

since_timemodified - core_date

Unix timemodification timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

Example
{
  "tag_filter": "education",
  "since_timecreated": "1696837540",
  "since_timemodified": "1696837540"
}

core_cohort_static_cohorts_query

Description

Input type used when querying for a list of audiences. Specifies pagination and sorting information that can impact the structure of the results.

Fields
Input Field Description
pagination - core_pagination_input

Pagination information such as which page to return and the number of results requested.

sort - [core_sort_input!]

The sort order of the query.

filter - core_cohort_static_cohorts_filter

The filter for querying static cohorts.

Example
{
  "pagination": core_pagination_input,
  "sort": [core_sort_input],
  "filter": core_cohort_static_cohorts_filter
}

core_cohort_static_cohorts_result

Description

Result returned from the core_cohort_static_cohorts query. Contains a page of results along with pagination information.

Fields
Field Name Description
items - [core_cohort]! Array of one page of audiences returned by the query.
total - Int! Total number of users from this query (across all pages).
next_cursor - String! Cursor to request the next set of results for this query.
Example
{
  "items": [
    {
      "id": "3",
      "name": "Avengers",
      "description": "Description",
      "idnumber": "AUD0001",
      "type": "STATIC",
      "members_count": 2,
      "tags": {"rawname": "Education", "name": "education"}
    },
    {
      "id": "4",
      "name": "Math team",
      "description": "Math team description",
      "idnumber": "AUD0002",
      "type": "STATIC",
      "members_count": 3,
      "tags": {"rawname": "Education", "name": "education"}
    }
  ],
  "total": 47,
  "next_cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319"
}

core_cohort_type

Description

Constant for the audience type.

Values
Enum Value Description

STATIC

DYNAMIC

Example
"STATIC"

Basic goal

Queries

goaltype_basic_creation_config

Description

Fetch creation config

Response

Returns a goaltype_basic_creation_config!

Example

Query
query goaltype_basic_creation_config {
  goaltype_basic_creation_config {
    options {
      ...goaltype_basic_creation_optionFragment
    }
  }
}
Response
{
  "data": {
    "goaltype_basic_creation_config": {
      "options": [goaltype_basic_creation_option]
    }
  }
}

Types

goaltype_basic_creation_config

Fields
Field Name Description
options - [goaltype_basic_creation_option!]!
Example
{"options": [goaltype_basic_creation_option]}

goaltype_basic_creation_option

Fields
Field Name Description
id - String!
name - String!
description - String!
icon_component - String!
ui_component - String!
Example
{
  "id": "abc123",
  "name": "abc123",
  "description": "abc123",
  "icon_component": "abc123",
  "ui_component": "abc123"
}

Completion tracking

Queries

core_completion_get_course_completion

Description

Query to get course completion data for a user in a course.

Arguments
Name Description
query - core_completion_get_course_completion_input! The parameter object for this query. This object requires a user reference and course reference.

Example

Query
query core_completion_get_course_completion($query: core_completion_get_course_completion_input!) {
  core_completion_get_course_completion(query: $query) {
    user {
      ...core_userFragment
    }
    course {
      ...core_courseFragment
    }
    completion {
      ...core_course_completionFragment
    }
  }
}
Variables
{"query": core_completion_get_course_completion_input}
Response
{
  "data": {
    "core_completion_get_course_completion": {
      "user": {"id": 4, "fullname": "John Smith"},
      "course": {"id": 4, "fullname": "Course 1"},
      "completion": {
        "id": 4,
        "status": "5",
        "timecompleted": "1696837540",
        "gradefinal": 6.5
      }
    }
  }
}

Types

core_completion_get_course_completion_input

Description

The get_course_completion query request parameter object. This object requires both the course and user reference.

Fields
Input Field Description
user - core_user_user_reference!

The user whose completion record is to be retrieved.

course - core_course_course_reference!

The course to which the completion record belongs.

Example
{
  "user": {"id": "4", "idnumber": "user123"},
  "course": {"id": "4", "idnumber": "course123"}
}

core_completion_get_course_completion_result

Description

The results of a query to retrieve course completion data.

Fields
Field Name Description
user - core_user! The user who was specified in the query.
course - core_course! The course that was specified in the query.
completion - core_course_completion The course completion data for the user in the course, or NULL if no record was found.
Example
{
  "user": {"id": 4, "fullname": "John Smith"},
  "course": {"id": 4, "fullname": "Course 1"},
  "completion": {
    "id": 4,
    "status": "5",
    "timecompleted": "1696837540",
    "gradefinal": 6.5
  }
}

Course Catalogue

Queries

totara_catalog_filters

Description

Query to fetch available catalog filters and filter options.

Response

Returns a totara_catalog_filters_result!

Arguments
Name Description
input - totara_catalog_url_query_input

Example

Query
query totara_catalog_filters($input: totara_catalog_url_query_input) {
  totara_catalog_filters(input: $input) {
    filters {
      ...totara_catalog_filterFragment
    }
    browse_filter {
      ...totara_catalog_filterFragment
    }
    sort {
      ...totara_catalog_filterFragment
    }
  }
}
Variables
{"input": totara_catalog_url_query_input}
Response
{
  "data": {
    "totara_catalog_filters": {
      "filters": [totara_catalog_filter],
      "browse_filter": totara_catalog_filter,
      "sort": totara_catalog_filter
    }
  }
}

totara_catalog_item_details

Description

Query to get details panel content for a learning item.

Arguments
Name Description
input - totara_catalog_item_details_input!

Example

Query
query totara_catalog_item_details($input: totara_catalog_item_details_input!) {
  totara_catalog_item_details(input: $input) {
    details {
      ...totara_catalog_item_detailsFragment
    }
  }
}
Variables
{"input": totara_catalog_item_details_input}
Response
{
  "data": {
    "totara_catalog_item_details": {
      "details": totara_catalog_item_details
    }
  }
}

totara_catalog_items

Description

Query to fetch a page of catalog learning items.

Response

Returns a totara_catalog_items_result!

Arguments
Name Description
input - totara_catalog_url_query_input!

Example

Query
query totara_catalog_items($input: totara_catalog_url_query_input!) {
  totara_catalog_items(input: $input) {
    items {
      ...totara_catalog_itemFragment
    }
    limitfrom
    maxcount
    filters {
      ...totara_catalog_filterFragment
    }
    browse_filter {
      ...totara_catalog_filterFragment
    }
    sort {
      ...totara_catalog_filterFragment
    }
    is_filtered
    endofrecords
    suggestion
  }
}
Variables
{"input": totara_catalog_url_query_input}
Response
{
  "data": {
    "totara_catalog_items": {
      "items": [totara_catalog_item],
      "limitfrom": "677c3ee51363c",
      "maxcount": 100,
      "filters": [totara_catalog_filter],
      "browse_filter": totara_catalog_filter,
      "sort": totara_catalog_filter,
      "is_filtered": true,
      "endofrecords": true,
      "suggestion": "xyz789"
    }
  }
}

totara_catalog_search_filter_options

Description

Query to look up the top 10 matching options for a specific filter. Useful for filters with a lot of options, to narrow down the number of options presented to the user.

Example

Query
query totara_catalog_search_filter_options($input: totara_catalog_search_filter_options_input!) {
  totara_catalog_search_filter_options(input: $input) {
    filter_options
  }
}
Variables
{"input": totara_catalog_search_filter_options_input}
Response
{
  "data": {
    "totara_catalog_search_filter_options": {
      "filter_options": ["basketball", "football"]
    }
  }
}

totara_catalog_top_items_grouped

Description

Query to fetch top catalog learning items grouped by type.

Only ever fetches the first page of items of each type. Additional pages must be fetched using totara_catalog_items with the objecttype filter set appropriately.

Arguments
Name Description
input - totara_catalog_url_query_input!

Example

Query
query totara_catalog_top_items_grouped($input: totara_catalog_url_query_input!) {
  totara_catalog_top_items_grouped(input: $input) {
    groups {
      ...totara_catalog_top_items_groupedFragment
    }
  }
}
Variables
{"input": totara_catalog_url_query_input}
Response
{
  "data": {
    "totara_catalog_top_items_grouped": {
      "groups": [totara_catalog_top_items_grouped]
    }
  }
}

totara_catalog_url_query_validation

Description

Query to validate catalog URL query string or structured query JSON.

Arguments
Name Description
input - totara_catalog_url_query_input!

Example

Query
query totara_catalog_url_query_validation($input: totara_catalog_url_query_input!) {
  totara_catalog_url_query_validation(input: $input) {
    total_count
    error
    error_message
  }
}
Variables
{"input": totara_catalog_url_query_input}
Response
{
  "data": {
    "totara_catalog_url_query_validation": {
      "total_count": 7,
      "error": true,
      "error_message": "xyz789"
    }
  }
}

Types

totara_catalog_filter

Description

Catalog filter type, collects a named group of options with a defined key for use in catalog queries.

Fields
Field Name Description
key - String! Filter key that is catalog url query param eg ?course_type_panel[]=1.
title - String! Filter title / label.
type - String! Option type.
options - [totara_catalog_filter_option_union]! Filter options.
Example
{
  "key": "catalog_learning_type_panel",
  "title": "Learning type",
  "type": "multi",
  "options": [totara_catalog_option]
}

totara_catalog_filter_option_union

Description

Union type allowing for different types of filter option to be used

Example
totara_catalog_option

totara_catalog_filters_result

Description

Filters query result, lists the active filters and sorting options in the catalog.

Fields
Field Name Description
filters - [totara_catalog_filter]! Active filters.
browse_filter - totara_catalog_filter Filter selected as "Browse filter".
sort - totara_catalog_filter Sort option.
Example
{
  "filters": [totara_catalog_filter],
  "browse_filter": totara_catalog_filter,
  "sort": totara_catalog_filter
}

totara_catalog_item

Description

Catalog learning item type, used to display information about an individual learning item in a card.

Fields
Field Name Description
itemid - core_id! Catalog item database id. This is different from the item's actual course or resource id.
type_label - String! Type of catalog item (singular), e.g. Course
title - String! Item title.
featured - Boolean! 'Featured' is enabled or not for this item.
redirecturl - String! Item URL. This URL may contain additional parameters that redirect the user back to the catalog.
image_enabled - Boolean! Image is enabled or not for this item.
image - totara_catalog_item_image Item image.
logo - totara_catalog_item_image Item logo, if enabled.
objecttype - String! Item's learning type.
hero_data_text_enabled - Boolean! Hero data text is enabled or not for this item.
hero_data_text - String Hero data text.
hero_data_type - String Hero data type.
hero_data_icon_enabled - Boolean! Hero data icon is enabled or not for this item.
hero_data_icon - totara_catalog_item_icon Hero data icon.
progress_bar_enabled - Boolean! Progress bar is enabled or not for this item.
progress_bar - totara_catalog_item_progress_bar Progress bar.
description_enabled - Boolean! Description is enabled or not for this item.
description - String Item short description.
text_placeholders_enabled - Boolean! Text placeholders are enabled or not for this item.
text_placeholders - [totara_catalog_text_placeholder] Text placeholders.
icon_placeholders_enabled - Boolean! Icon placeholders are enabled or not for this item.
icon_placeholders - [totara_catalog_item_icon] Icon placeholders.
Example
{
  "itemid": 20,
  "type_label": "abc123",
  "title": "Security essentials",
  "featured": true,
  "redirecturl": "http://localhost/course/view.php?id=115",
  "image_enabled": true,
  "image": totara_catalog_item_image,
  "logo": totara_catalog_item_image,
  "objecttype": "course",
  "hero_data_text_enabled": true,
  "hero_data_text": "hero",
  "hero_data_type": "text",
  "hero_data_icon_enabled": true,
  "hero_data_icon": totara_catalog_item_icon,
  "progress_bar_enabled": true,
  "progress_bar": totara_catalog_item_progress_bar,
  "description_enabled": true,
  "description": "<p>The course description</p>",
  "text_placeholders_enabled": true,
  "text_placeholders": [totara_catalog_text_placeholder],
  "icon_placeholders_enabled": true,
  "icon_placeholders": [totara_catalog_item_icon]
}

totara_catalog_item_details

Description

Catalog learning item details type, used to display detailed information about the learning item in a panel.

Fields
Field Name Description
title - String Item title.
manage_link - totara_catalog_item_link Manage link.
details_link - totara_catalog_item_details_link Details link block.
rich_text - String Main rich text content.
Arguments
format - core_format
description - String Item short description.
text_placeholders - [totara_catalog_text_placeholder] Text placeholders.
icon_placeholders - [totara_catalog_item_icon] Icon placeholders.
Example
{
  "title": "Swimming program",
  "manage_link": totara_catalog_item_link,
  "details_link": totara_catalog_item_details_link,
  "rich_text": "<div class=\"text_to_html\">Program summary here.</div>",
  "description": "xyz789",
  "text_placeholders": [totara_catalog_text_placeholder],
  "icon_placeholders": [totara_catalog_item_icon]
}

totara_catalog_item_details_input

Description

Catalog learning item details input type.

Fields
Input Field Description
itemid - core_id!

Item id.

Example
{"itemid": 4}

totara_catalog_item_details_result

Description

Catalog learning item details result.

Fields
Field Name Description
details - totara_catalog_item_details! Catalog item details.
Example
{"details": totara_catalog_item_details}

totara_catalog_item_icon

Description

Catalog learning item icon type.

Fields
Field Name Description
url - String Icon image URL.
alt - String Icon alt text.
icon - String Icon name.
Example
{
  "url": "http://localhost/theme/image.php/inspire/totara_core/1732046708/programicons/default",
  "alt": "Icon",
  "icon": "abc123"
}

totara_catalog_item_image

Description

Catalog learning item image type.

Fields
Field Name Description
url - String! Image URL.
alt - String! Image alt text.
Example
{
  "url": "http://localhost/pluginfile.php/988/totara_program/images/224/1024px-Metrobaan_Duikerlaan_-_panoramio.jpg?preview=totara_catalog_medium&theme=inspire",
  "alt": "Image"
}

totara_catalog_item_progress_bar

Description

Catalog learning item progress bar type.

Fields
Field Name Description
progress - Float Learner's progress, out of 100
Example
{"progress": 123.45}

totara_catalog_items_result

Description

Catalog learning items result. Contains a page of learning items which match a query, and metadata about the page and total result set.

Fields
Field Name Description
items - [totara_catalog_item]! Catalog learning items.
limitfrom - String! The cursor to use in query_structure input to fetch the next page of items.
maxcount - Int! The approximate total number of items in the result set. Due to visibility restrictions, this number may not be an accurate total.
filters - [totara_catalog_filter] Active filters.
browse_filter - totara_catalog_filter Filter selected as "Browse filter".
sort - totara_catalog_filter Sort options.
is_filtered - Boolean! Flag to indicate whether the query has any filters applied or not.
endofrecords - Boolean! Flag to indicate if there are any more records to load.
suggestion - String Proposed alternative search term
Example
{
  "items": [totara_catalog_item],
  "limitfrom": "677c3ee51363c",
  "maxcount": 100,
  "filters": [totara_catalog_filter],
  "browse_filter": totara_catalog_filter,
  "sort": totara_catalog_filter,
  "is_filtered": true,
  "endofrecords": true,
  "suggestion": "xyz789"
}

totara_catalog_option

Description

Generic catalog filter option type.

Fields
Field Name Description
id - String! Option id.
label - String! Option label.
active - Boolean! Option is active or not, in other words, it's selected/default or not.
Example
{"id": "Courses", "label": "course", "active": true}

totara_catalog_search_filter_options_input

Description

Search filter options input type.

Fields
Input Field Description
search_term - param_text!

User search term.

filter_key - String!

Filter key.

Example
{"search_term": "text_to_search", "filter_key": "tag_panel_1"}

totara_catalog_search_filter_options_result

Description

Search filter options result type.

Fields
Field Name Description
filter_options - [String]! Filter options.
Example
{"filter_options": ["basketball", "football"]}

totara_catalog_text_placeholder

Description

Catalog learning item text placeholder type.

Fields
Field Name Description
data_exists - Boolean! Data exists or not.
data - String Data.
show_label - Boolean Show label or not.
label - String label.
Example
{
  "data_exists": true,
  "data": "abc123",
  "show_label": true,
  "label": "xyz789"
}

totara_catalog_top_items_grouped

Description

Grouped items type, a collection of learning items and the type associated with them.

Fields
Field Name Description
objecttype - String! Object type.
items - [totara_catalog_item]! Group of items.
Example
{
  "objecttype": "Certification",
  "items": [totara_catalog_item]
}

totara_catalog_top_items_grouped_result

Description

Top grouped items result type, used to display catalog learning items grouped by type.

Fields
Field Name Description
groups - [totara_catalog_top_items_grouped] Item groups.
Example
{"groups": [totara_catalog_top_items_grouped]}

totara_catalog_tree_option

Description

Catalog tree filter option type, used for hierarchical options.

Fields
Field Name Description
id - String! Node id.
parentid - String Node parent id, might be null if top-level.
label - String! Node name.
active - Boolean! Option is active or not, in other words, it's selected/default or not.
Example
{
  "id": 3,
  "parentid": "xyz789",
  "label": "Miscellaneous",
  "active": true
}

totara_catalog_url_query_input

Description

Parameters used to define catalog search query.

Use either query_string or query_structure.

The format of this input matches the URL query parameters used with the Totara 'grid' or 'explore' catalogs, one of which must be enabled to use this API.

Fields
Input Field Description
query_string - String

URL query string. Query string from any existing catalog search can be used here. Use this option for the first page of results only.

The list of expected query keys for query_string search:

  • Active filter aliases
  • objecttype
  • perpageload
  • orderbykey
query_structure - String

URL query structure as a JSON blob of key-value pairs. Use this option if you need pagination.

The list of expected query keys for query_structure search:

  • Active filter aliases
  • objecttype
  • perpageload
  • orderbykey
  • limitfrom (pagination cursor; only for pages 2 through n)
Example
{
  "query_string": "catalog_learning_type_panel[0]=course&course_type_panel[0]=0&course_acttyp_panel[0]=7&catalog_cat_panel=3&contentmarketplace_provider_panel[0]=0&tag_panel_1[0]=9&course_format_panel[0]=singleactivity&article_timeview_panel[0]=2&perpageload=10",
  "query_structure": "{\"catalog_cat_browse\":\"1259\",\"catalog_learning_type_panel\":[\"certification\",\"course\"],\"tag_panel_1\":[\"31\"],\"limitfrom\":\"abc123def0\"}"
}

totara_catalog_url_query_validation_result

Description

URL query validation result type, provides metadata about a given query.

Fields
Field Name Description
total_count - Int! Total number of learning items.
error - Boolean! The flag to indicate the URL query has error or not.
error_message - String Error message.
Example
{
  "total_count": 7,
  "error": true,
  "error_message": "abc123"
}

Customfields

Types

totara_customfield_definition

Description

A single custom field definition. Represents details about the custom field. For example, identifying information (such as fullname or shortname) as well as defining information (such as the default value and type)

Fields
Field Name Description
id - core_id! The custom field definition ID.
fullname - String Custom field full name.
shortname - String Custom field short name.
type - totara_customfield_type! The type of custom field. Defined by an enum of available formats the user can choose from when setting up custom fields in Totara.
description - String Custom field description.
raw_default_value - String The raw default value of the custom fieid without any transformation. This is the raw representation of the data. See totara_customfield_type for more information on specific implementations.
default_value - totara_customfield_value_type Custom field default value.
Example
{
  "id": 4,
  "fullname": "xyz789",
  "shortname": "xyz789",
  "type": "CHECKBOX",
  "description": "xyz789",
  "raw_default_value": "xyz789",
  "default_value": totara_customfield_value_type_generic
}

totara_customfield_field

Description

A single custom field object. This object contains value of the custom field (both the raw value stored in the database, and the value dependant on the custom field type). We also provide information about the custom field through the definition property, including the name, shortname, type and description).

Custom fields are user-defined extra fields in Totara to store additional information not covered by the usual fields a component has.

Custom fields are used in many different components in Totara including courses, seminars and evidence.

Fields
Field Name Description
definition - totara_customfield_definition! The custom field's definition. This includes identifying information (such as fullname or shortname) as well as defining information (such as the default value and type).
raw_value - String The raw value of the custom field without any transformation. This is the raw representation of the data. If no value is set for the related item, then definition.raw_default_value is used.
value - totara_customfield_value_type

The value set against the related item. If no value is set for the related item, then definition.default_value is used.

For example, if we have a custom field 'Custom Field A' for courses with a default value of 'My default value' and we have a course 'Course 1', but no data has been set for the custom field on the course, Then the value for Course 1 will be 'My default value'. However, if we then edit Course 1 and set the value for Custom Field A for the course to 'My new value', the value returned will be 'My new value'.

Example
{
  "definition": totara_customfield_definition,
  "raw_value": "abc123",
  "value": totara_customfield_value_type_generic
}

totara_customfield_input

Description

Input type representing a single custom field for a particular type. Please note: setting custom fields may require certain capabilites

Fields
Input Field Description
shortname - String!

The shortname of the custom field.

Note: if the same custom field is provided multiple times in a single request they will be applied in order so the last one will be used.

data - String

Represents the value for the custom field. The format of this data will depend on the field type of the field. See below for a list of types that are supported.

Types and their expected inputs:

  • checkbox: 0 (unchecked) or 1 (checked).
  • menu: A string exactly matching one of the menu options (case sensitive).
  • text: Plain text.
  • datetime: A string in the format YYYY-MM-DD or YYYY-MM-DD-HH-MM-SS (depending on if the field uses the 'Include time?' option). If the field defines a year range, the input will be validated to ensure it falls within that range. If only YYYY-MM-DD is provided for a field where 'Include time?' is enabled, 00:00 will be used for the time. Stored as a unix timestamp.
  • integer: A string representing an integer value E.g. 10
  • decimal: A string representing a decimal value E.g. 10.59

Setting data to null will delete the existing value for that custom field. This will set the value back to the default value.

Note: We currently do not support file, textarea, url, multiselect, location. If one of this is used, an exception will be thrown stating an unsupported datatype was used.

Example
{
  "shortname": "abc123",
  "data": "abc123"
}

totara_customfield_type

Description

Enum of the different types of custom fields. These relate to the different types of custom fields available to the user when creating custom fields in Totara.

Values
Enum Value Description

CHECKBOX

Checkbox type. The raw value is stored as a 0 (for false) or a 1 (for true).

MULTISELECT

Multiselect type. The raw value defines a string JSON object with hashes of the options as keys. An example of this structure would look like:

{
  "an_md5_hash_for_the_option": {
    "option": "my option value", -- Defines the value of the option
    "icon": "", -- The icon displayed with the option
    "default": "0", -- Whether the value is selected by default
    "delete": "0", -- Whether the value is deleted.
  }
}

Note: the default value for a custom field's definition will return null due to a limitation of how multiselect stores default options.

FILE

File types are currently unsupported. A custom field with the type FILE will always return null for value, raw_value, raw_default_value and default_value properties.

DATETIME

Datetime type. The raw value is stored as a UNIX timestamp.

TEXTAREA

Textarea type. The raw value can be different depending on the text editor used.

For example, if Weka (JSON_EDITOR) was used, the raw value for this will be a JSON object in the format the JSON_EDITOR expects. However, if the Atto editor was used, the raw value may include HTML. These two editors are not the only options for editor. The output is determined on the particular editor used, which varies depending on user preference.

A single editor is also not guaranteed for a single custom field's uses. Depending on a user's editor preferences, different editors may have been used for different uses of the textarea custom field.

For example, let's say there's two courses; CourseA and CourseB and both of these courses have a custom field "MyTextarea", and two users; UserAtto and UserWeka. If UserAtto has the Atto editor set as their editor preference, and UserWeka, Weka., then it's possible for a textarea custom field (MyTextarea) on CourseA to use Atto when first edited by UserAtto and for CourseB to use Weka when edited by UserWeka. However, if UserAtto then edits CourseB, they will see and use Weka, and vice versa. This is a limitation of the textarea custom field.

URL

URL type. The raw value can either be a JSON value or a plain URL.

  • The raw value will be a JSON string when the custom field's value has been set on the item (e.g. the custom field has been set on a course).
  • The raw value will be a plain text URL when the value has not been set on the item, and is following the custom field definition's default value.
  • The raw default value will always be a plain text URL, so long as a value is set.

LOCATION

Location type. For type location, the default value (including raw_default_value) will be null, regardless of configuration.

The raw value is a JSON object representing both location and display properties. An example is provided below.

{
  "address": "186 Willis Street", -- A user editable textarea field specifying an address.
  "size": "medium", -- A display property for Google maps. Defines the size of the Google maps canvas. For values, see totara_customfield_value_type_location_size
  "view": "map", -- A display property for Google maps. Defines the type of view Google maps should display. For values, see totara_customfield_value_type_location_view
  "zoom": 12, -- A display property for Google maps. Defines the level of zoom when displaying Google maps. Defines the level of zoom when displaying Google maps.
  "display": "address", -- A display property for the custom field. Defines which fields to show for the custom field (maps, address or both). For values, see totara_customfield_value_type_location_display
  "coordinates": { -- The geographical coordinates (longitude and latitude) for a given location.
    "latitude": -41.2917599,
    "longitude": 174.7704544
  }
}

MENU

Menu type. The type allows for a single choice of many values for the custom field. The raw value will be the value selected.

TEXT

Text type.

INTEGER

Integer type.

DECIMAL

Decimal type.

UNKNOWN

Unknown type. This type is used for types which aren't defined in the tye totara_customfield_type enum.
Example
"CHECKBOX"

totara_customfield_value_type

Description

Defines the different supported types available for custom fields. If a specific type has not been defined for custom fields, the totara_customfield_type_generic type will be used. When requesting fields on types used in a union it is a good idea to use aliases for the properties (e.g. value is a field on a datetime type and on a text type, specifying an alias for the field will help ensure you get back the expected field for the expected type).

Note: custom fields with type 'TEXTAREA' will utilise the totara_customfield_type_generic type due to there currently being a lack of support for formatting editor content in Totara.

Example of use in a query:

custom_fields {
    value {
        __typename
        ... on totara_customfield_value_type_generic {
            raw_value
        }
        ... on totara_customfield_value_type_multiselect {
            options {
                option
            }
        }
        ...on totara_customfield_value_type_datetime {
            datetime_value: value (format: ISO8601)
        }
        ... on totara_customfield_value_type_text {
            text_value: value
        }
    }
}
Example
totara_customfield_value_type_generic

totara_customfield_value_type_checkbox

Description

The checkbox custom field type.

Fields
Field Name Description
checked - Boolean Whether or not the option is checked.
Example
{"checked": true}

totara_customfield_value_type_datetime

Description

The datetime custom field type.

Fields
Field Name Description
value - core_date

Formatted value of the date time value. Raw value is stored as a UNIX timestamp.

Formats as TIMESTAMP by default.

Arguments
format - core_date_format
Example
{"value": "2022-04-17"}

totara_customfield_value_type_decimal

Description

The decimal custom field type.

Fields
Field Name Description
value - Float The value of the decimal.
Example
{"value": 123.45}

totara_customfield_value_type_generic

Description

Generic custom field type. Used to handle unknown custom field types.

Fields
Field Name Description
raw_value - String The raw value of the custom field. Raw string representation of the data stored.
Example
{"raw_value": "abc123"}

totara_customfield_value_type_integer

Description

The integer custom field type.

Fields
Field Name Description
value - Int The value of the integer.
Example
{"value": 123}

totara_customfield_value_type_location

Description

The location custom field type.

For type location, the default value (including raw_default_value) will be null, regardless of configuration.

Fields
Field Name Description
address - String A user editable textarea field specifying an address.
zoom - Int A display property for Google maps. Defines the level of zoom when displaying Google maps.
size - totara_customfield_value_type_location_size A display property for Google maps. Defines the size of the Google maps canvas.
view - totara_customfield_value_type_location_view A display property for Google maps. Defines the type of view Google maps should display.
display - totara_customfield_value_type_location_display A display property for the custom field. Defines which fields to show for the custom field (maps, address or both).
coordinates - totara_customfield_value_type_location_coordinates The geographical coordinates (longitude and latitude) for a given location.
Example
{
  "address": "abc123",
  "zoom": 987,
  "size": "SMALL",
  "view": "MAP",
  "display": "BOTH",
  "coordinates": totara_customfield_value_type_location_coordinates
}

totara_customfield_value_type_location_coordinates

Description

Defines the geographical coordinates for the location custom field.

Fields
Field Name Description
longitude - Float Longitude is a geographic coordinate that specifies the east–west position of a point on the surface of the Earth
latitude - Float Latitude is a geographic coordinate that specifies the north-south position of a point on the surface of the Earth
Example
{"longitude": 987.65, "latitude": 123.45}

totara_customfield_value_type_location_display

Description

Defines the content displayed for the location custom field.

Values
Enum Value Description

BOTH

MAP

ADDRESS

Example
"BOTH"

totara_customfield_value_type_location_size

Description

Defines the Google maps display size for the location custom field.

Values
Enum Value Description

SMALL

MEDIUM

LARGE

Example
"SMALL"

totara_customfield_value_type_location_view

Description

Defines the Google maps view options for the location custom field.

Values
Enum Value Description

MAP

SATELLITE

HYBRID

Example
"MAP"

totara_customfield_value_type_menu

Description

The menu custom field type.

Fields
Field Name Description
option - String The value of the option selected.
Example
{"option": "xyz789"}

totara_customfield_value_type_multiselect

Description

Multiselect custom field.

  • When options have been selected for a particular item, this will return an array of the selected options.
  • For default values, this will return null due to a limitation of how multiselect stores default options.
Fields
Field Name Description
options - [totara_customfield_value_type_multiselect_option] The options for the multiselect field.
Example
{
  "options": [
    totara_customfield_value_type_multiselect_option
  ]
}

totara_customfield_value_type_multiselect_option

Description

A single option value for a multiselect.

Fields
Field Name Description
option - String The value of the option.
Example
{"option": "xyz789"}

totara_customfield_value_type_text

Description

The text custom field type.

Fields
Field Name Description
value - String The value of the text field.
Example
{"value": "abc123"}

totara_customfield_value_type_url

Description

The URL custom field type.

Fields
Field Name Description
url - String The URL value of the custom field.
text - String

The text value of the custom field.

Due to a limitation of how this value is stored on custom field definitions, this returns null for default values and values which use the default.

Example
{
  "url": "xyz789",
  "text": "xyz789"
}

Enrol

Types

core_enrol

Description

Represents an enrolment instance.

Fields
Field Name Description
id - core_id! The unique identifier for the enrolment instance.
enrol - String! The enrolment method or type as a string.
status - core_enrol_status_enum! The status of the enrolment instance.
course - core_course! The course associated with the enrolment instance.
sortorder - Int! The sort order of the enrolment instance.
Example
{
  "id": 9,
  "enrol": "totara_program",
  "status": "ENROL_INSTANCE_ENABLED",
  "course": {"id": 2, "idnumber": "abc"},
  "sortorder": "3"
}

core_enrol_status_enum

Description

Enumerates the possible enrolment status values for an enrolment instance.

Values
Enum Value Description

ENROL_INSTANCE_ENABLED

The enrolment instance is enabled.

ENROL_INSTANCE_DISABLED

The enrolment instance is disabled.

ENROL_INSTANCE_DELETED

The enrolment instance has been deleted.
Example
"ENROL_INSTANCE_ENABLED"

Hierarchies

Types

totara_hierarchy_framework

Description

Hierarchy framework interface. Defines standard fields available in all hierarchy frameworks. A framework is a collection of hierarchy items arranged in a tree.

Fields
Field Name Description
id - core_id! Internal database id of the framework.
fullname - String! Full name of the framework.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the framework across multiple systems.
shortname - String The short name of the framework. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the framework.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 7,
  "fullname": "Example hierarchy framework",
  "idnumber": "HFW123",
  "shortname": "example_hierarchy_framework",
  "description": "This is an example hierarchy framework."
}

totara_hierarchy_item

Description

Hierarchy item interface. Defines standard fields available in all hierarchy items. A hierarchy item is a single node in a tree-like hierarchy of items.

Fields
Field Name Description
id - core_id! Internal database id of the hierarchy item.
fullname - String! Full name of the hierarchy item.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the hierarchy item across multiple systems.
shortname - String The short name of the hierarchy item. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the hierarchy item.
Arguments
format - core_format

Output format this field should be formatted for.

frameworkid - core_id The internal database id of the hierarchy framework this item belongs to.
framework - totara_hierarchy_framework The hierarchy framework this item belongs to.
path - String! An ordered list of parent database ids for this hierarchy item, indicating the hierarchy of parent items. Includes the current item and separated by forward slashes, e.g. item with id=6 might be: /1/4/6 This is a computed value.
visible - Boolean! Flag determining whether the hierarchy item is visible to end users or not.
parentid - core_id The id of this hierarchy item's immediate parent in the framework hierarchy. Set to 0 if this is a top-level item.
parent - totara_hierarchy_item The parent item in the hierarchy. Null if a top-level item.
children - [totara_hierarchy_item!]! Collection of hierarchy items that are immediately below this one in the framework hierarchy. Empty if this item has no children.
typeid - core_id The id of the hierarchy item type, or 0 if this is a generic item.
type - totara_hierarchy_type Hierarchy item type object.
timemodified - core_date! Timestamp of when the hierarchy item type was last modified. Available since Totara 19.0.1.
Arguments
format - core_date_format
Example
{
  "id": 9,
  "fullname": "Example hierarchy item",
  "idnumber": "HI567",
  "shortname": "example_hierarchy_item",
  "description": "This is an example hierarchy item.",
  "frameworkid": 5,
  "framework": {"id": 8, "fullname": "Example hierarchy framework"},
  "path": "/1/2/45",
  "visible": true,
  "parentid": 4,
  "parent": {"id": 16, "fullname": "Example hierarchy item"},
  "children": [
    {"id": 5, "fullname": "Example hierarchy item"},
    {"id": 7, "fullname": "Another example hierarchy item"}
  ],
  "typeid": 14,
  "type": {"id": 3, "fullname": "Example hierarchy type"},
  "timemodified": "2022-04-17"
}

totara_hierarchy_organisation

Description

Organisation item object.

The organisation structure defines the regions, departments, groups, areas, or teams that a company has defined.

Fields
Field Name Description
id - core_id! Internal database id of the organisation.
fullname - String! Full name of the organisation.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation across multiple systems.
shortname - String The short name of the organisation. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation.
Arguments
format - core_format

Output format this field should be formatted for. Please note: RAW format is only available to users with the capability 'totara/hierarchy:updateorganisation' in the system context, as its purpose is for editing.

frameworkid - core_id The internal database id of the organisation framework this organisation belongs to. Please note: viewing this organisation's frameworkid requires the capability 'totara/hierarchy:vieworganisationframeworks'
framework - totara_hierarchy_organisation_framework The organisation framework this organisation belongs to. Please note: viewing this organisation's framework requires the capability 'totara/hierarchy:vieworganisationframeworks'
path - String! An ordered list of parent database ids for this organisation, indicating the hierarchy of parent items. Includes the current item and separated by forward slashes, e.g. item with id=6 might be: /1/4/6 This is a computed value.
visible - Boolean! Flag determining whether the organisation is visible to end users or not.
parentid - core_id The id of this organisation's immediate parent in the framework hierarchy. Set to 0 if this is a top-level organisation.
parent - totara_hierarchy_organisation The parent organisation in the hierarchy. Null if a top-level item.
children - [totara_hierarchy_organisation!]! Collection of organisations that are immediately below this one in the framework hierarchy. Empty if this organisation has no children.
typeid - core_id The id of the organisation type, or 0 if this is a generic organisation.
type - totara_hierarchy_organisation_type Organisation type object.
timemodified - core_date! Timestamp of when the organisation type was last modified. Available since Totara 19.0.1.
Arguments
format - core_date_format
Example
{
  "id": 27,
  "fullname": "Sales and Marketing",
  "idnumber": "SM1",
  "shortname": "sales",
  "description": "Sales and marketing are based in our US office.",
  "frameworkid": 6,
  "framework": {"id": 7, "fullname": "Global company organisation structure"},
  "path": "/4/22/27",
  "visible": true,
  "parentid": 4,
  "parent": {"id": 22, "fullname": "Head Office"},
  "children": [
    {"id": 45, "fullname": "US sales team"},
    {"id": 37, "fullname": "Europe sales team"}
  ],
  "typeid": 7,
  "type": {"id": 3, "fullname": "Organisational units"},
  "timemodified": "2022-04-17"
}

totara_hierarchy_organisation_framework

Description

Organisation framework object. An organisation framework is a collection of organisations arranged in a tree.

Fields
Field Name Description
id - core_id! Internal database id of the organisation framework.
fullname - String! Full name of the organisation framework.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation framework across multiple systems.
shortname - String Short name of the organisation framework, only used if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation framework.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 7,
  "fullname": "Global company organisation structure",
  "idnumber": "MAIN1",
  "shortname": "global_structure",
  "description": "This is the main organisation framework for organisations for our company."
}

totara_hierarchy_organisation_reference

Description

Input for identifying an organisation.

The organisation must be identified by providing one of the following:

  • The organisation's internal database id
  • The organisation's idnumber

An organisation reference must uniquely identify a single organisation to be valid.

Fields
Input Field Description
id - core_id

Identify an organisation by internal database id.

idnumber - String

Identify an organisation by its idnumber. idnumber is a unique reference used to represent the organisation across multiple systems.

Example
{"id": 4, "idnumber": "org1"}

totara_hierarchy_organisation_type

Description

Organisation type object. An organisation type is a user-defined classification which can be assigned to organisations leading to certain custom fields being available on that organisation.

Fields
Field Name Description
id - core_id! Internal database id of the organisation type.
fullname - String! Organisation type full name.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation type across multiple systems.
shortname - String The short name of the organisation type. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation type.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 3,
  "fullname": "Organisational units",
  "idnumber": "ORG1",
  "shortname": "org_units",
  "description": "This type defines organisation units with specific business functions."
}

totara_hierarchy_position

Description

Position item object.

The position structure defines the job roles that a company has defined.

Fields
Field Name Description
id - core_id! Internal database id of the position.
fullname - String! Full name of the position.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position across multiple systems.
shortname - String The short name of the position. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position.
Arguments
format - core_format

Output format this field should be formatted for. Please note: RAW format is only available to users with the capability 'totara/hierarchy:updateorganisation' in the system context, as its purpose is for editing.

frameworkid - core_id The internal database id of the position framework this position belongs to. Please note: viewing this position's frameworkid requires the capability 'totara/hierarchy:viewpositionframeworks'
framework - totara_hierarchy_position_framework The position framework this position belongs to. Please note: viewing this position's framework requires the capability 'totara/hierarchy:viewpositionframeworks'
path - String! An ordered list of parent database ids for this position, indicating the hierarchy of parent items. Includes the current item and separated by forward slashes, e.g. item with id=6 might be: /1/4/6 This is a computed value.
visible - Boolean! Flag determining whether the position is visible to users or not.
parentid - core_id The id of this position's immediate parent in the framework hierarchy. Set to 0 if this is a top-level position.
parent - totara_hierarchy_position The parent position in the hierarchy. Null if a top-level item.
children - [totara_hierarchy_position!]! Collection of positions that are immediately below this one in the framework hierarchy. Empty if this position has no children.
typeid - core_id The id of the position type, or 0 if this is a generic position.
type - totara_hierarchy_position_type Position type object.
timemodified - core_date! Timestamp of when the position type was last modified. Available since Totara 19.0.1.
Arguments
format - core_date_format
Example
{
  "id": 27,
  "fullname": "Senior project manager",
  "idnumber": "PM3",
  "shortname": "senior_project_manager",
  "description": "A grade 3 project manager.",
  "frameworkid": 6,
  "framework": {"id": 7, "fullname": "Active company roles"},
  "path": "/4/22/27",
  "visible": true,
  "parentid": 4,
  "parent": {"id": 22, "fullname": "Project Manager"},
  "children": [],
  "typeid": 7,
  "type": {"id": 3, "fullname": "Managerial roles"},
  "timemodified": "2022-04-17"
}

totara_hierarchy_position_framework

Description

Position framework object. A position framework is a collection of positions arranged in a tree.

Fields
Field Name Description
id - core_id! Internal database id of the position framework.
fullname - String! Full name of the position framework.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position framework across multiple systems.
shortname - String Short name of the position framework, only used if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position framework.
Arguments
format - core_format

Output format this field should be formatted for.

positions - [totara_hierarchy_position!]! Positions that belong to this position framework.
Example
{
  "id": 7,
  "fullname": "Active company roles",
  "idnumber": "ACTIVEROLES",
  "shortname": "active_roles",
  "description": "This is the main position framework for active positions used by our company.",
  "positions": [totara_hierarchy_position]
}

totara_hierarchy_position_reference

Description

Input for identifying a position.

The position must be identified by providing one of the following:

  • The position's internal database id
  • The position's idnumber

A position reference must uniquely identify a single position to be valid.

Fields
Input Field Description
id - core_id

Identify a position by internal database id.

idnumber - String

Identify a position by its idnumber. idnumber is a unique reference used to represent the position across multiple systems.

Example
{"id": 4, "idnumber": "pos1"}

totara_hierarchy_position_type

Description

Position type object. A position type is a user-defined classification which can be assigned to positions leading to certain custom fields being available on that position.

Fields
Field Name Description
id - core_id! Internal database id of the position type.
fullname - String! Position type full name.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position type across multiple systems.
shortname - String The short name of the position type. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position type.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 3,
  "fullname": "Managerial roles",
  "idnumber": "MAN1",
  "shortname": "manager_roles",
  "description": "This type defines positions with line management responsibility."
}

totara_hierarchy_type

Description

Hierarchy type interface. Defines standard fields available in all hierarchy types. A hierarchy type is a user-defined classification which can be assigned to hierarchy items leading to certain custom fields being available on that item.

Fields
Field Name Description
id - core_id! Internal database id of the hierarchy type.
fullname - String! Type full name.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the type across multiple systems.
shortname - String The short name of the type. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the type.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 3,
  "fullname": "Example hierarchy type",
  "idnumber": "HTY123",
  "shortname": "example_hierarchy_type",
  "description": "This is an example hierarchy type."
}

IntelliData

Queries

bi_intellidata_data_files

Description

Returns the result of a data files schema query.

Arguments
Name Description
input - bi_intellidata_data_files_input

Example

Query
query bi_intellidata_data_files($input: bi_intellidata_data_files_input) {
  bi_intellidata_data_files(input: $input) {
    items {
      ...bi_intellidata_data_files_fileFragment
    }
    metadata {
      ...bi_intellidata_data_files_metadataFragment
    }
  }
}
Variables
{"input": bi_intellidata_data_files_input}
Response
{
  "data": {
    "bi_intellidata_data_files": {
      "items": [bi_intellidata_data_files_file],
      "metadata": bi_intellidata_data_files_metadata
    }
  }
}

bi_intellidata_dbschema_custom

Description

Returns the result of the custom database schema query.

Example

Query
query bi_intellidata_dbschema_custom {
  bi_intellidata_dbschema_custom {
    items {
      ...bi_intellidata_dbschema_custom_tableFragment
    }
  }
}
Response
{
  "data": {
    "bi_intellidata_dbschema_custom": {
      "items": [bi_intellidata_dbschema_custom_table]
    }
  }
}

bi_intellidata_dbschema_unified

Description

Returns the fields schema for unified tables, i.e. the list and fields structure for all Required Tables.

Example

Query
query bi_intellidata_dbschema_unified {
  bi_intellidata_dbschema_unified {
    items {
      ...bi_intellidata_dbschema_unified_tableFragment
    }
  }
}
Response
{
  "data": {
    "bi_intellidata_dbschema_unified": {
      "items": [bi_intellidata_dbschema_unified_table]
    }
  }
}

bi_intellidata_export_logs

Description

Fetches the intellidata plugin export logs information, i.e. for the migration / export logs.

Example

Query
query bi_intellidata_export_logs {
  bi_intellidata_export_logs {
    items {
      ...bi_intellidata_export_logs_logFragment
    }
  }
}
Response
{
  "data": {
    "bi_intellidata_export_logs": {
      "items": [bi_intellidata_export_logs_log]
    }
  }
}

bi_intellidata_live_data

Description

Returns the results of a query for live data records.

Arguments
Name Description
input - bi_intellidata_live_data_input! Fetches live data for a specific datatype. Allowed datatypes are: 'roles', 'categories', 'courses'.

Example

Query
query bi_intellidata_live_data($input: bi_intellidata_live_data_input!) {
  bi_intellidata_live_data(input: $input) {
    data
  }
}
Variables
{"input": bi_intellidata_live_data_input}
Response
{
  "data": {
    "bi_intellidata_live_data": {
      "data": "abc123"
    }
  }
}

bi_intellidata_plugin_config

Description

Fetches Totara and plugin version and configuration information.

Example

Query
query bi_intellidata_plugin_config {
  bi_intellidata_plugin_config {
    moodleconfig {
      ...bi_intellidata_moodleconfigFragment
    }
    cronconfig {
      ...bi_intellidata_cronconfigFragment
    }
    pluginconfig {
      ...bi_intellidata_pluginconfigFragment
    }
    pluginversion
  }
}
Response
{
  "data": {
    "bi_intellidata_plugin_config": {
      "moodleconfig": bi_intellidata_moodleconfig,
      "cronconfig": [bi_intellidata_cronconfig],
      "pluginconfig": bi_intellidata_pluginconfig,
      "pluginversion": "2023010612"
    }
  }
}

bi_intellidata_validate_credentials

Description

Validates IntelliBoard keys and setup.

Arguments
Name Description
input - bi_intellidata_validate_credentials_input! The input data for validating credentials.

Example

Query
query bi_intellidata_validate_credentials($input: bi_intellidata_validate_credentials_input!) {
  bi_intellidata_validate_credentials(input: $input) {
    data
  }
}
Variables
{"input": bi_intellidata_validate_credentials_input}
Response
{"data": {"bi_intellidata_validate_credentials": {"data": "ok"}}}

Mutations

bi_intellidata_enable_processing

Description

This endpoint is for enabling/disabling Data processing on the Totara side via the IntelliBoard plugin.

Arguments
Name Description
input - bi_intellidata_enable_processing_input! The input data for the enable_processing request.

Example

Query
mutation bi_intellidata_enable_processing($input: bi_intellidata_enable_processing_input!) {
  bi_intellidata_enable_processing(input: $input) {
    data
  }
}
Variables
{"input": bi_intellidata_enable_processing_input}
Response
{"data": {"bi_intellidata_enable_processing": {"data": "ok"}}}

bi_intellidata_export_data

Description

This endpoint processes exporting data from the 'temp' location to storage.

Example

Query
mutation bi_intellidata_export_data {
  bi_intellidata_export_data {
    items {
      ...bi_intellidata_data_files_fileFragment
    }
    metadata {
      ...bi_intellidata_data_files_metadataFragment
    }
  }
}
Response
{
  "data": {
    "bi_intellidata_export_data": {
      "items": [bi_intellidata_data_files_file],
      "metadata": bi_intellidata_data_files_metadata
    }
  }
}

bi_intellidata_set_datatype

Description

Adds or updates (resets) new custom table to the export mechanism.

Arguments
Name Description
input - bi_intellidata_set_datatype_input!

Example

Query
mutation bi_intellidata_set_datatype($input: bi_intellidata_set_datatype_input!) {
  bi_intellidata_set_datatype(input: $input) {
    data
  }
}
Variables
{"input": bi_intellidata_set_datatype_input}
Response
{
  "data": {
    "bi_intellidata_set_datatype": {"data": "Datatype successfully added."}
  }
}

Types

bi_intellidata_cronconfig

Description

Cron configure type that maps into table 'task_scheduled'

Fields
Field Name Description
id - Int! Id
component - String Component
classname - String Classname
lastruntime - core_date Last run time
Arguments
format - core_date_format
nextruntime - core_date Next run time
Arguments
format - core_date_format
blocking - String Blocking
minute - String Minute
hour - String Hour
day - String Day
month - String Month
dayofweek - String Day of week
faildelay - String Fail delay
disabled - Int Disabled
customised - Int Customised
Example
{
  "id": 123,
  "component": "bi_intellidata",
  "classname": "\\bi_intellidata\\task\\migration_task",
  "lastruntime": "2022-04-17",
  "nextruntime": "2022-04-17",
  "blocking": "0",
  "minute": "1",
  "hour": "1",
  "day": "*",
  "month": "*",
  "dayofweek": "*",
  "faildelay": "0",
  "disabled": "1",
  "customised": "0"
}

bi_intellidata_data_files_file

Description

Type representing a collection of data files.

Fields
Field Name Description
datatype - String! Data type filter.
files - [bi_intellidata_data_files_file_instance]! List of files.
migration_files - [bi_intellidata_data_files_file_instance]! List of migration files.
Example
{
  "datatype": "xyz789",
  "files": [bi_intellidata_data_files_file_instance],
  "migration_files": [
    bi_intellidata_data_files_file_instance
  ]
}

bi_intellidata_data_files_file_instance

Description

Type representing a single data file.

Fields
Field Name Description
filename - String! File name.
filearea - String! File area.
itemid - Int! Item ID.
filepath - String! File path.
mimetype - String MIME type.
filesize - Int! File size.
timemodified - core_date Time last modified.
Arguments
format - core_date_format
isexternalfile - Boolean! Indicates whether the file is external or not.
fileurl - String! File URL.
repositorytype - String Repository type, if the file is external.
Example
{
  "filename": "d19c2ecf20245b4d.zip",
  "filearea": "userlogins",
  "itemid": 987,
  "filepath": "/",
  "mimetype": "application/zip",
  "filesize": 208,
  "timemodified": 1678110847,
  "isexternalfile": true,
  "fileurl": "http://totara/api/pluginfile.php/1/bi_intellidata/userlogins/0/d19c2ecf20245b4d.zip",
  "repositorytype": "xyz789"
}

bi_intellidata_data_files_input

Description

Input data for fetching data files.

Fields
Input Field Description
timestart - core_date

Start time.

timeend - core_date

End time.

datatype - String

Data type filter.

Example
{
  "timestart": "2022-04-17",
  "timeend": "2022-04-17",
  "datatype": "abc123"
}

bi_intellidata_data_files_metadata

Description

Metadata type for data files.

Fields
Field Name Description
lastmigrationdate - core_date! Last migration date.
Arguments
format - core_date_format
lastexportdate - core_date! Last export date.
Arguments
format - core_date_format
pluginversion - String! Plugin version.
Example
{
  "lastmigrationdate": 1678836325,
  "lastexportdate": 1678110847,
  "pluginversion": 2023010612
}

bi_intellidata_data_files_result

Description

Type representing the result of a data_files query.

Fields
Field Name Description
items - [bi_intellidata_data_files_file]! List of data files.
metadata - bi_intellidata_data_files_metadata! Metadata for the data files.
Example
{
  "items": [bi_intellidata_data_files_file],
  "metadata": bi_intellidata_data_files_metadata
}

bi_intellidata_dbschema_custom_result

Description

A type that represents the result of a custom database schema query.

Fields
Field Name Description
items - [bi_intellidata_dbschema_custom_table]!
Example
{"items": [bi_intellidata_dbschema_custom_table]}

bi_intellidata_dbschema_custom_table

Description

A type that represents a custom table in a database schema.

Fields
Field Name Description
name - String! The name of the table.
fields - [bi_intellidata_dbschema_custom_table_field!]! The fields that the table has.
plugintype - String The plugin type.
plugin - String The plugin name.
keys - [bi_intellidata_dbschema_custom_table_key]! The keys that the table has.
Example
{
  "name": "course_sections",
  "fields": [bi_intellidata_dbschema_custom_table_field],
  "plugintype": "course",
  "plugin": "core",
  "keys": [bi_intellidata_dbschema_custom_table_key]
}

bi_intellidata_dbschema_custom_table_field

Description

A type that represents a field in a custom table of a database schema.

Fields
Field Name Description
type - String! The data type of the field.
name - String! The name of the field.
has_default - Boolean Whether the field has default value.
max_length - Int The maximum length of the field.
primary_key - Boolean Whether the field is primary key.
not_null - Boolean Whether the field cannot be null.
auto_increment - Boolean Whether the field can auto increment.
default_value - String The default value of the field.
Example
{
  "type": "text",
  "name": "name",
  "has_default": true,
  "max_length": 20,
  "primary_key": true,
  "not_null": true,
  "auto_increment": true,
  "default_value": "xyz789"
}

bi_intellidata_dbschema_custom_table_key

Description

A type that represents a table key in a custom table of a database schema.

Fields
Field Name Description
name - String! The type of key, eg. primary.
fields - [String!]! The fields that the key is related to.
reftable - String The table the key refers to
reffields - [String]! The fields the key refers to
Example
{"name": "primary", "fields": ["id"], "reftable": "users", "reffields": []}

bi_intellidata_dbschema_unified_result

Description

A type that represents the result of a unified database schema query.

Fields
Field Name Description
items - [bi_intellidata_dbschema_unified_table!]!
Example
{"items": [bi_intellidata_dbschema_unified_table]}

bi_intellidata_dbschema_unified_table

Description

A type that represents a unified table in a database schema.

Fields
Field Name Description
name - String! The name of the entity that the table represents.
fields - [bi_intellidata_dbschema_unified_table_field!]! The fields that the table has.
Example
{
  "name": "users",
  "fields": [bi_intellidata_dbschema_unified_table_field]
}

bi_intellidata_dbschema_unified_table_field

Description

A type that represents a field in a unified table of a database schema.

Fields
Field Name Description
field_name - String! The name of the field.
type - String! The data type of the field.
description - String A description of the field.
default - String The default value of the field.
null - Boolean Whether the field can be null.
Example
{
  "field_name": "username",
  "type": "RAW",
  "description": "Username description",
  "default": "abc123",
  "null": true
}

bi_intellidata_enable_processing_input

Description

The parameters to go in a request to enable_processing.

Fields
Input Field Description
status - Int!

1 or 0. 1 - Enable, 0 - Disable.

callbackurl - String

The URL to send a callback request to Intelliboard Next.

Example
{"status": 1, "callbackurl": "https://mycallback.com?key=1234"}

bi_intellidata_enable_processing_result

Description

The response after a request was made to set the enable/disable status of the IntelliBoard plugin.

Fields
Field Name Description
data - String! If the enable setting was successful, this should be 'ok'.
Example
{"data": "ok"}

bi_intellidata_export_data_result

Description

Type representing the result of a export_data mutation.

Fields
Field Name Description
items - [bi_intellidata_data_files_file]! List of data files.
metadata - bi_intellidata_data_files_metadata! Metadata for the data files.
Example
{
  "items": [bi_intellidata_data_files_file],
  "metadata": bi_intellidata_data_files_metadata
}

bi_intellidata_export_logs_log

Description

Details about the Intelliboard integration plugin export logs.

Fields
Field Name Description
id - core_id! ID identifying the bi_intellidata_export_log.
datatype - String The data source for the export log, usually a table.
last_exported_time - core_date The most recent time the log was exported.
Arguments
format - core_date_format
last_exported_id - core_id The maximum ID in the data source when the log was last exported.
migrated - Int The migration status value, i.e. 0 = inprogress, 1 = completed, 2 = pending.
timestart - core_date The time the migration task began.
Arguments
format - core_date_format
recordsmigrated - Int Count of migrated records.
recordscount - Int Count of records.
tabletype - Int The type the plugin the plugin assigns the data source / table, i.e. required = 0, optional = 1, logs = 2.
timecreated - core_date The time the export_log record was created. This may be null and not recorded.
Arguments
format - core_date_format
timemodified - core_date The time the export_log record was altered. This may be null and not recorded.
Arguments
format - core_date_format
usermodified - Int The ID of the user who altered the export_log record.
Example
{
  "id": 4,
  "datatype": "xyz789",
  "last_exported_time": 1678110847,
  "last_exported_id": 12345,
  "migrated": 1,
  "timestart": 1678110847,
  "recordsmigrated": 123,
  "recordscount": 456,
  "tabletype": 1,
  "timecreated": 1678110847,
  "timemodified": 1678110847,
  "usermodified": 9876
}

bi_intellidata_export_logs_result

Description

Contains a list of export log record items.

Fields
Field Name Description
items - [bi_intellidata_export_logs_log]! Export log records.
Example
{"items": [bi_intellidata_export_logs_log]}

bi_intellidata_live_data_input

Description

The input data for querying by datatype.

Fields
Input Field Description
datatype - String!

The 'data source', usually a database table, for querying. Datatypes allowed are: 'roles', 'categories', 'courses' .

Example
{"datatype": "xyz789"}

bi_intellidata_live_data_result

Description

Response type for a live data query.

Fields
Field Name Description
data - String! A JSON-encoded string representing live data records.
Example
{"data": "abc123"}

bi_intellidata_moodleconfig

Description

Moodle configure type, containing basic moodle information

Fields
Field Name Description
version - String! Moodle version
release - String! Moodle release date
dbtype - String! Database type
moodleworkplace - Boolean Moodle workplace exists or not
totaraversion - String! Totara version
Example
{
  "version": "2022110800.03",
  "release": "3.4.9 (Build: 20190513)",
  "dbtype": "pgsql",
  "moodleworkplace": "0",
  "totaraversion": "17.3"
}

bi_intellidata_plugin_config_result

Description

Plugin config result type, containing moodle config, bi_intellidata config and cron config.

Fields
Field Name Description
moodleconfig - bi_intellidata_moodleconfig! Moodle configure
cronconfig - [bi_intellidata_cronconfig]! Cron configure
pluginconfig - bi_intellidata_pluginconfig! bi_intellidata plugin configure
pluginversion - String! Plugin version
Example
{
  "moodleconfig": bi_intellidata_moodleconfig,
  "cronconfig": [bi_intellidata_cronconfig],
  "pluginconfig": bi_intellidata_pluginconfig,
  "pluginversion": "2023010612"
}

bi_intellidata_pluginconfig

Description

The Intelliboard plugin's configuration settings.

Fields
Field Name Description
title - String! Configuration title.
items - [bi_intellidata_pluginconfig_setting!]! Configuration settings.
Example
{
  "title": "title",
  "items": [bi_intellidata_pluginconfig_setting]
}

bi_intellidata_pluginconfig_setting

Description

An Intelliboard plugin configuration setting.

Fields
Field Name Description
type - String! Type
subtype - String! Subtype that represents setting, eg. checkbox.
title - String! Title
name - String! Name
grouptitle - String Group title for each setting section name. Note: this could be null.
value - String! Setting value. If the value is an array it will be encoded into a string. If the subtype is 'checkbox', the value will be 1 or 0.
Example
{
  "type": "setting",
  "subtype": "select",
  "title": "title",
  "name": "name",
  "grouptitle": "xyz789",
  "value": "standard"
}

bi_intellidata_set_datatype_input

Description

Trigger to export files after inserting custom table. 0 = do not process migration, 1 = create an ad-hoc task to process export with the next cron run. Default value is 0.

Fields
Input Field Description
datatypes - [String!]!

Custom table name(s)

exportfiles - Int

Trigger to export files after inserting custom table 0 - do not process migration 1 - create ad-hoc task to process export with next cron run Default value is 0

callbackurl - String

Callback URL to send request when export completed. Working only if not empty and exportfiles = 1

Example
{
  "datatypes": ["abc123"],
  "exportfiles": 1,
  "callbackurl": "https://mycallback.com?key=1234"
}

bi_intellidata_set_datatype_result

Description

The result of attempting to set a custom datatype.

Fields
Field Name Description
data - String! The operation result message.
Example
{"data": "Datatype successfully added."}

bi_intellidata_validate_credentials_input

Description

The input data required for validating credentials.

Fields
Input Field Description
code - String!

The code containing the client identifier.

Example
{"code": "xyz789"}

bi_intellidata_validate_credentials_result

Description

A type that represents the result of validating credentials, containing data about whether the validation was successful or not.

Fields
Field Name Description
data - String! The result data from the validation operation.
Example
{"data": "ok"}

Job assignments

Queries

totara_job_job_assignment

Description

Return a single job_assignment from the system. Multitenancy restrictions apply.

Arguments
Name Description
target_job - totara_job_job_assignment_reference! The job assignment that we want to retrieve.

Example

Query
query totara_job_job_assignment($target_job: totara_job_job_assignment_reference!) {
  totara_job_job_assignment(target_job: $target_job) {
    job_assignment {
      ...totara_job_job_assignmentFragment
    }
    found
  }
}
Variables
{"target_job": totara_job_job_assignment_reference}
Response
{
  "data": {
    "totara_job_job_assignment": {
      "job_assignment": totara_job_job_assignment,
      "found": true
    }
  }
}

totara_job_job_assignments

Description

Return a paginated list of job_assignments in the system. Multitenancy restrictions apply.

Arguments
Name Description
query - totara_job_job_assignments_query

Example

Query
query totara_job_job_assignments($query: totara_job_job_assignments_query) {
  totara_job_job_assignments(query: $query) {
    items {
      ...totara_job_job_assignmentFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": totara_job_job_assignments_query}
Response
{
  "data": {
    "totara_job_job_assignments": {
      "items": [totara_job_job_assignment],
      "total": 123,
      "next_cursor": "abc123"
    }
  }
}

Mutations

totara_job_create_job_assignment

Description

Creates a new job assignment.

Arguments
Name Description
input - totara_job_create_job_assignment_input! Input object specifying data for creating the new job assignment.

Example

Query
mutation totara_job_create_job_assignment($input: totara_job_create_job_assignment_input!) {
  totara_job_create_job_assignment(input: $input) {
    job_assignment {
      ...totara_job_job_assignmentFragment
    }
  }
}
Variables
{"input": totara_job_create_job_assignment_input}
Response
{
  "data": {
    "totara_job_create_job_assignment": {
      "job_assignment": totara_job_job_assignment
    }
  }
}

totara_job_delete_job_assignment

Description

Mutation to delete a job assignment.

Arguments
Name Description
target_job - totara_job_job_assignment_reference! Input provided for identifying the job assignment.

Example

Query
mutation totara_job_delete_job_assignment($target_job: totara_job_job_assignment_reference!) {
  totara_job_delete_job_assignment(target_job: $target_job) {
    job_assignment_id
  }
}
Variables
{"target_job": totara_job_job_assignment_reference}
Response
{"data": {"totara_job_delete_job_assignment": {"job_assignment_id": 4}}}

totara_job_update_job_assignment

Description

Updates a specific target job assignment with new properties.

Arguments
Name Description
target_job - totara_job_job_assignment_reference! The job assignment that should be updated.
input - totara_job_update_job_assignment_input! Input object specifying data for updating the job assignment.

Example

Query
mutation totara_job_update_job_assignment(
  $target_job: totara_job_job_assignment_reference!,
  $input: totara_job_update_job_assignment_input!
) {
  totara_job_update_job_assignment(
    target_job: $target_job,
    input: $input
  ) {
    job_assignment {
      ...totara_job_job_assignmentFragment
    }
  }
}
Variables
{
  "target_job": totara_job_job_assignment_reference,
  "input": totara_job_update_job_assignment_input
}
Response
{
  "data": {
    "totara_job_update_job_assignment": {
      "job_assignment": {
        "id": 7,
        "idnumber": "PM3",
        "fullname": "Senior project manager",
        "user": {"fullname": "John Smith"}
      }
    }
  }
}

Types

totara_job_create_job_assignment_input

Description

Input data for creating a job assignment.

Fields
Input Field Description
idnumber - String!

A unique reference used to represent the job assignment across multiple systems. If the reference value is not unique, this can be combined with the job_assignment id and user_id in queries to behave like a unique compound reference value in order to refer to a single job_assignment.

fullname - String

The full name of the job assignment.

shortname - String

The short name of the job assignment.

user - core_user_user_reference!

The user to create the job assignment for.

start_date - core_date

Date that the user started in this job assignment.

end_date - core_date

Date that the user ends in this job assignment.

position - totara_hierarchy_position_reference

Position (job role) that applies to this job assignment.

organisation - totara_hierarchy_organisation_reference

Organisation in which the user holds this job assignment.

manager - totara_job_job_assignment_reference

Job assignment that defines the management relationship.

appraiser - core_user_user_reference

Appraiser for this assignment.

temp_manager - totara_job_job_assignment_reference

Job assignment that defines the temporary management relationship.

temp_manager_expiry_date - core_date

Date the temporary manager assignment will expire.

Example
{
  "idnumber": "abc123",
  "fullname": "abc123",
  "shortname": "abc123",
  "user": core_user_user_reference,
  "start_date": "2022-04-17",
  "end_date": "2022-04-17",
  "position": totara_hierarchy_position_reference,
  "organisation": totara_hierarchy_organisation_reference,
  "manager": totara_job_job_assignment_reference,
  "appraiser": core_user_user_reference,
  "temp_manager": totara_job_job_assignment_reference,
  "temp_manager_expiry_date": "2022-04-17"
}

totara_job_create_job_assignment_result

Description

Mutation result type returned after creating a job assignment. Returns information about the job assignment that was created.

Fields
Field Name Description
job_assignment - totara_job_job_assignment! The newly created job assignment.
Example
{"job_assignment": totara_job_job_assignment}

totara_job_delete_job_assignment_result

Description

Mutation result type returned after deletion of a job assignment.

Fields
Field Name Description
job_assignment_id - core_id! Database id of the job assignment.
Example
{"job_assignment_id": 4}

totara_job_job_assignment

Description

Job assignment type object, containing information about an individual job assignment.

Fields
Field Name Description
id - core_id! Internal database id of the job assignment.
userid - core_id! User id of the user the job assignment is associated with.
user - core_user! User record of the user the job assignment is associated with.
fullname - String The full name of the job assignment. Used when job assignment is displayed and for selecting job assignments in dialogs.
Arguments
format - core_format

Output format this field should be formatted for.

shortname - String The short name of the job assignment. Only used as additional information.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String! Used when syncing job assignment data from external sources. Must be unique for each user (but two users could have the same job assignment idnumber). If the reference value is not unique, this can be combined with the job_assignment id and user_id in queries to behave like a unique compound reference value in order to refer to a single job_assignment.
description - String Rich-text description of the job assignment.
Arguments
format - core_format

Output format this field should be formatted for.

startdate - core_date

Date that the user started in this job assignment. This date can be used in dynamic audience rules.

This date is not used by the system to determine if the job assignment is active.

Arguments
format - core_date_format

Output date format this field should be formatted using.

enddate - core_date

Date that the user ends in this job assignment. This date can be used in dynamic audience rules.

This date is not used by the system to determine if the job assignment is active.

Arguments
format - core_date_format

Output date format this field should be formatted using.

positionid - core_id Internal database id of the position for this assignment.
position - totara_hierarchy_position Position (job role) object for this job assignment.
organisationid - core_id Internal database id of the organisation for this job assignment.
organisation - totara_hierarchy_organisation Organisation object for this job assignment.
managerjaid - core_id Internal database id of the manager job assignment.
managerja - totara_job_job_assignment Job assignment object that defines the management relationship.
tempmanagerjaid - core_id Internal database id of the temporary manager job assignment. Temporary manager has the same rights as a normal manager, until the expiry date is reached.
tempmanagerja - totara_job_job_assignment Job assignment object that defines the temporary management relationship.
tempmanagerexpirydate - core_date Date the temporary manager assignment will expire.
Arguments
format - core_date_format

Output date format this field should be formatted using.

appraiserid - core_id Internal database id of the user assigned as the appraiser for this job assignment.
appraiser - core_user Appraiser user object for this job assignment.
staffcount - Int! Number of staff assigned to the user via this job assignment. E.g. the number of other job assignments which list this assignment as 'managerja'.
tempstaffcount - Int! Number of staff assigned to the user to temporarily manage via this job assignment. E.g. the number of other job assignments which list this assignment as 'tempmanagerja'.
timemodified - core_date The date/time the job assignment was last modified
Arguments
format - core_date_format
Example
{
  "id": 4,
  "userid": 4,
  "user": {"username": "joe.smith"},
  "fullname": "Senior Project Manager",
  "shortname": "senior_pm",
  "idnumber": "PM3",
  "description": "Grade 3 project manager.",
  "startdate": "2022-04-17",
  "enddate": "2022-04-17",
  "positionid": 4,
  "position": {"idnumber": "pos1"},
  "organisationid": 4,
  "organisation": {"idnumber": "org2"},
  "managerjaid": 4,
  "managerja": {"idnumber": "managerjob1"},
  "tempmanagerjaid": 4,
  "tempmanagerja": {"idnumber": "tempmanagerjob1"},
  "tempmanagerexpirydate": "2022-04-17",
  "appraiserid": 4,
  "appraiser": {"email": "appraiser@example.com"},
  "staffcount": 10,
  "tempstaffcount": 3,
  "timemodified": "2022-04-17"
}

totara_job_job_assignment_reference

Description

Input for identifying a job assignment.

The job assignment must be identified by providing one of the following:

  • The job assignment's internal database id
  • The job assignment's idnumber

A job assignment reference must uniquely identify a single job assignment record to be valid.

Fields
Input Field Description
id - core_id

Identify a job assignment by internal database id.

idnumber - String

Identify a job assignment by its idnumber.

Idnumber is a unique reference used to represent a job assignment across multiple systems. If the reference value is not unique, this can be combined with the job_assignment id and user_id in queries to behave like a unique compound reference value in order to refer to a single job_assignment.

user - core_user_user_reference

The user who has received the job_assignment.

Example
{
  "id": 4,
  "idnumber": "job1",
  "user": core_user_user_reference
}

totara_job_job_assignment_result

Description

Query result type returned after querying a single job assignment.

Fields
Field Name Description
job_assignment - totara_job_job_assignment The found job assignment.
found - Boolean! Whether the job assignment requested is available to the viewing user
Example
{
  "job_assignment": totara_job_job_assignment,
  "found": true
}

totara_job_job_assignments_query

Description

Information on paginating and sorting the results.

Fields
Input Field Description
pagination - core_pagination_input

Pagination information such as which page to return and the number of results requested.

sort - [core_sort_input!]

The sort order of the query. Allowed entity fields for the sort column are 'id', 'userid', 'shortname', 'startdate', 'endate', 'position', 'organisation', 'managerjaid', 'tempmanagerjaid', 'tempmanagerexpirydate', 'appraiserid', 'staffcount', 'tempstaffcount'.

filters - totara_job_job_assignments_query_filters

An input object for specifying criteria to narrow down query results of job assignments.

Example
{
  "pagination": core_pagination_input,
  "sort": [core_sort_input],
  "filters": totara_job_job_assignments_query_filters
}

totara_job_job_assignments_query_filters

Fields
Input Field Description
since_timemodified - core_date

Filters retrieved job assignments to those modified on or since the given date.

Example
{"since_timemodified": "2022-04-17"}

totara_job_job_assignments_result

Description

Result returned from the totara_job_job_assignments query. Contains a page of results along with pagination information.

Fields
Field Name Description
items - [totara_job_job_assignment] Array of one page of job_assignments returned by the query.
total - Int! Total number of job_assignments from this query (across all pages).
next_cursor - String! Cursor to request the next set of results for this query.
Example
{
  "items": [totara_job_job_assignment],
  "total": 123,
  "next_cursor": "xyz789"
}

totara_job_update_job_assignment_input

Description

The input data for updating the job assignment.

Fields
Input Field Description
idnumber - String

Unique reference used to represent the job assignment across multiple systems. If the reference value is not unique, this can be combined with the job_assignment id and user_id in queries to behave like a unique compound reference value in order to refer to a single job_assignment.

fullname - String

The full name of the job assignment.

shortname - String

The short name of the job assignment.

start_date - core_date

Date that the user started in this job assignment.

end_date - core_date

Date that the user ends in this job assignment.

position - totara_hierarchy_position_reference

Position (job role) for the user.

organisation - totara_hierarchy_organisation_reference

Organisation in which the user works.

manager - totara_job_job_assignment_reference

Job assignment that defines the management relationship.

appraiser - core_user_user_reference

Appraiser for this assignment.

temp_manager - totara_job_job_assignment_reference

Job assignment that defines the temporary management relationship.

temp_manager_expiry_date - core_date

Date the temporary manager assignment will expire.

Example
{
  "idnumber": "PM3",
  "fullname": "Senior Project Manager",
  "shortname": "abc123",
  "start_date": "2020-07-15",
  "end_date": "2025-03-26",
  "position": {"idnumber": "pos1"},
  "organisation": {"idnumber": "org1"},
  "manager": {"idnumber": "managerjob1"},
  "appraiser": {"username": "jane.doe"},
  "temp_manager": {"idnumber": "tempmanagerjob1"},
  "temp_manager_expiry_date": "2025-04-16"
}

totara_job_update_job_assignment_result

Description

Mutation result type returned after updating a job assignment. Returns the job assignment that was updated.

Fields
Field Name Description
job_assignment - totara_job_job_assignment! The updated job assignment.
Example
{
  "job_assignment": {
    "id": 7,
    "idnumber": "PM3",
    "fullname": "Senior project manager",
    "user": {"fullname": "John Smith"}
  }
}

Manual enrolments

Mutations

enrol_manual_enrol_user

Description

Add a manual enrolment into the target course for the target user. The API User role must be able to assign the corresponding role to the enrolled user.

Response

Returns an enrol_manual_enrol_user_result!

Arguments
Name Description
input - enrol_manual_enrol_user_input! Input object specifying data for enrolling the user.

Example

Query
mutation enrol_manual_enrol_user($input: enrol_manual_enrol_user_input!) {
  enrol_manual_enrol_user(input: $input) {
    user {
      ...core_userFragment
    }
    course {
      ...core_courseFragment
    }
    role {
      ...core_roleFragment
    }
    enrolment {
      ...core_user_enrolmentFragment
    }
    success
    was_already_enrolled
  }
}
Variables
{"input": enrol_manual_enrol_user_input}
Response
{
  "data": {
    "enrol_manual_enrol_user": {
      "user": {"id": 12, "idnumber": "123"},
      "course": {"id": 22, "idnumber": "222"},
      "role": {"id": 5, "shortname": "learner"},
      "enrolment": {
        "id": 122,
        "timestart": "1698227823",
        "timeend": "1698227824",
        "status": "ENROL_USER_ACTIVE"
      },
      "success": true,
      "was_already_enrolled": true
    }
  }
}

enrol_manual_unenrol_user

Description

Remove any manual enrolments for the target user from the target course. If multiple manual enrolments (with different roles) exist for the same user, they will all be removed. Does not affect other enrolment types, such as self-enrolment.

Response

Returns an enrol_manual_unenrol_user_result!

Arguments
Name Description
input - enrol_manual_unenrol_user_input! Input object specifying data for unenrolling the user.

Example

Query
mutation enrol_manual_unenrol_user($input: enrol_manual_unenrol_user_input!) {
  enrol_manual_unenrol_user(input: $input) {
    user {
      ...core_userFragment
    }
    course {
      ...core_courseFragment
    }
    success
    user_had_manual_enrolment
  }
}
Variables
{"input": enrol_manual_unenrol_user_input}
Response
{
  "data": {
    "enrol_manual_unenrol_user": {
      "user": {"id": 12, "idnumber": "123"},
      "course": {"id": 22, "idnumber": "222"},
      "success": true,
      "user_had_manual_enrolment": true
    }
  }
}

Types

enrol_manual_enrol_user_input

Description

Input required when enrolling a user.

Fields
Input Field Description
user - core_user_user_reference!

The target user to enrol in the course.

course - core_course_course_reference!

The target course to enrol the user in.

role - core_role_role_reference

The role for the enrolment. If no role is provided then the default role for this enrol will be used. In most cases that would be the Learner role.

timestart - core_date

The start date for the enrolment.

timeend - core_date

The end date for the enrolment.

suspended - Boolean

Whether the enrolment is suspended.

Example
{
  "user": core_user_user_reference,
  "course": core_course_course_reference,
  "role": core_role_role_reference,
  "timestart": "2022-04-17",
  "timeend": "2022-04-17",
  "suspended": true
}

enrol_manual_enrol_user_result

Description

Result object for mutation 'enrol_manual_enrol_user'.

Fields
Field Name Description
user - core_user! User object for the user that is enrolled into the course.
course - core_course! Course object.
role - core_role! Role object.
enrolment - core_user_enrolment! User enrolment object.
success - Boolean! Whether the enrolment was successful.
was_already_enrolled - Boolean! Whether the user was already enrolled in the course.
Example
{
  "user": {"id": 12, "idnumber": "123"},
  "course": {"id": 22, "idnumber": "222"},
  "role": {"id": 5, "shortname": "learner"},
  "enrolment": {
    "id": 122,
    "timestart": "1698227823",
    "timeend": "1698227824",
    "status": "ENROL_USER_ACTIVE"
  },
  "success": true,
  "was_already_enrolled": true
}

enrol_manual_unenrol_user_input

Description

Input required when unenrolling a user.

Fields
Input Field Description
user - core_user_user_reference!

Target user who will be unenroled from the course.

course - core_course_course_reference!

Target course.

Example
{
  "user": core_user_user_reference,
  "course": core_course_course_reference
}

enrol_manual_unenrol_user_result

Description

Result object for mutation enrol_manual_unenrol_user.

Fields
Field Name Description
user - core_user! User object for the user that is unenrolled from the course.
course - core_course! Course object.
success - Boolean! Whether all manual enrolments on this course have been removed for the user. Note that the user may still be enrolled via other methods.
user_had_manual_enrolment - Boolean! Whether the user had any manual enrolments on the course before this mutation.
Example
{
  "user": {"id": 12, "idnumber": "123"},
  "course": {"id": 22, "idnumber": "222"},
  "success": true,
  "user_had_manual_enrolment": true
}

Multitenancy

Types

totara_tenant_tenant_reference

Description

Input for identifying a tenant.

The tenant must be specified by providing one of the following:

  • The tenant's internal database id
  • The tenant's idnumber

A tenant reference must uniquely identify a single tenant to be valid.

Fields
Input Field Description
id - core_id

Identify a tenant by the internal database id of the tenant.

idnumber - String

Identify a tenant by the idnumber of the tenant. This is a unique reference used to represent the tenant across multiple systems.

Example
{"id": 5, "idnumber": "tenant1"}

Organisation Hierarchies

Queries

hierarchy_organisation_organisation

Description

Return a specific organisation.

Arguments
Name Description
reference - hierarchy_organisation_organisation_reference! Input object specifying data for the existing organisation.

Example

Query
query hierarchy_organisation_organisation($reference: hierarchy_organisation_organisation_reference!) {
  hierarchy_organisation_organisation(reference: $reference) {
    found
    organisation {
      ...hierarchy_organisation_organisationFragment
    }
  }
}
Variables
{
  "reference": hierarchy_organisation_organisation_reference
}
Response
{
  "data": {
    "hierarchy_organisation_organisation": {
      "found": true,
      "organisation": hierarchy_organisation_organisation
    }
  }
}

hierarchy_organisation_organisations

Description

Query to retrieve organisations.

Example

Query
query hierarchy_organisation_organisations($query: hierarchy_organisation_organisations_query) {
  hierarchy_organisation_organisations(query: $query) {
    items {
      ...hierarchy_organisation_organisationFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": hierarchy_organisation_organisations_query}
Response
{
  "data": {
    "hierarchy_organisation_organisations": {
      "items": [hierarchy_organisation_organisation],
      "total": 123,
      "next_cursor": "abc123"
    }
  }
}

Mutations

hierarchy_organisation_create_organisation

Description

Creates a new organisation. Please note: creating organisations requires the capability 'totara/hierarchy:createorganisation'

Arguments
Name Description
input - hierarchy_organisation_create_organisation_input! Input object specifying data for creating the new organisation.

Example

Query
mutation hierarchy_organisation_create_organisation($input: hierarchy_organisation_create_organisation_input!) {
  hierarchy_organisation_create_organisation(input: $input) {
    organisation {
      ...hierarchy_organisation_organisationFragment
    }
  }
}
Variables
{
  "input": hierarchy_organisation_create_organisation_input
}
Response
{
  "data": {
    "hierarchy_organisation_create_organisation": {
      "organisation": hierarchy_organisation_organisation
    }
  }
}

hierarchy_organisation_delete_organisation

Description

Mutation to delete an organisation. Please note: deleting organisations requires the capability 'totara/hierarchy:deleteorganisation'

Arguments
Name Description
target_organisation - hierarchy_organisation_organisation_reference! Input provided for identifying the organisation.

Example

Query
mutation hierarchy_organisation_delete_organisation($target_organisation: hierarchy_organisation_organisation_reference!) {
  hierarchy_organisation_delete_organisation(target_organisation: $target_organisation) {
    organisation_id
  }
}
Variables
{
  "target_organisation": hierarchy_organisation_organisation_reference
}
Response
{"data": {"hierarchy_organisation_delete_organisation": {"organisation_id": 4}}}

hierarchy_organisation_update_organisation

Description

Updates a specific target organisation with new properties. Please note: updating organisations requires the capability 'totara/hierarchy:updateorganisation'

Arguments
Name Description
target_organisation - hierarchy_organisation_organisation_reference! The organisation that should be updated.
input - hierarchy_organisation_update_organisation_input! Input object specifying data for updating the organisation.

Example

Query
mutation hierarchy_organisation_update_organisation(
  $target_organisation: hierarchy_organisation_organisation_reference!,
  $input: hierarchy_organisation_update_organisation_input!
) {
  hierarchy_organisation_update_organisation(
    target_organisation: $target_organisation,
    input: $input
  ) {
    organisation {
      ...hierarchy_organisation_organisationFragment
    }
  }
}
Variables
{
  "target_organisation": hierarchy_organisation_organisation_reference,
  "input": hierarchy_organisation_update_organisation_input
}
Response
{
  "data": {
    "hierarchy_organisation_update_organisation": {
      "organisation": hierarchy_organisation_organisation
    }
  }
}

Types

hierarchy_organisation_create_organisation_input

Description

Input provided when creating an organisation.

Fields
Input Field Description
fullname - String!

Full name of the organisation.

idnumber - String

Unique reference used to represent the organisation across multiple systems.

description - String

Rich-text description of the organisation.

framework - hierarchy_organisation_framework_reference!

The organisation framework this organisation belongs to.

parent - hierarchy_organisation_organisation_reference

The parent organisation in the hierarchy.

type - hierarchy_organisation_type_reference

Organisation type.

visible - Boolean

Flag determining whether the organisation is visible to end users or not. If not given, will default to visible.

custom_fields - [totara_customfield_input!]

Optional array of organisation type custom field data (each array element describes a single custom field value for this organisation).

Example
{
  "fullname": "abc123",
  "idnumber": "xyz789",
  "description": "abc123",
  "framework": hierarchy_organisation_framework_reference,
  "parent": hierarchy_organisation_organisation_reference,
  "type": hierarchy_organisation_type_reference,
  "visible": true,
  "custom_fields": [totara_customfield_input]
}

hierarchy_organisation_framework

Description

Organisation framework object. An organisation framework is a collection of organisations arranged in a tree.

Fields
Field Name Description
id - core_id! Internal database id of the organisation framework.
fullname - String! Full name of the organisation framework.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation framework across multiple systems.
shortname - String Short name of the organisation framework, only used if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation framework.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 4,
  "fullname": "abc123",
  "idnumber": "xyz789",
  "shortname": "xyz789",
  "description": "xyz789"
}

hierarchy_organisation_framework_reference

Description

Input for identifying an organisation framework.

Fields
Input Field Description
id - core_id

Identify an organisation framework by internal database id.

idnumber - String

Identify an organisation framework by its idnumber. idnumber is a unique reference used to represent the organisation framework across multiple systems.

Example
{"id": 4, "idnumber": "xyz789"}

hierarchy_organisation_organisation

Description

Organisation item object.

The organisation structure defines the regions, departments, groups, areas, or teams that a company has defined.

Fields
Field Name Description
id - core_id! Internal database id of the organisation.
fullname - String! Full name of the organisation.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation across multiple systems.
shortname - String The short name of the organisation. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation.
Arguments
format - core_format

Output format this field should be formatted for. Please note: RAW format is only available to users with the capability 'totara/hierarchy:updateorganisation' in the system context, as its purpose is for editing.

frameworkid - core_id The internal database id of the organisation framework this organisation belongs to. Please note: viewing this organisation's frameworkid requires the capability 'totara/hierarchy:vieworganisationframeworks'
framework - hierarchy_organisation_framework The organisation framework this organisation belongs to. Please note: viewing this organisation's framework requires the capability 'totara/hierarchy:vieworganisationframeworks'
path - String! An ordered list of parent database ids for this organisation, indicating the hierarchy of parent items. Includes the current item and separated by forward slashes, e.g. item with id=6 might be: /1/4/6 This is a computed value.
parentid - core_id The id of this organisation's immediate parent in the framework hierarchy. Set to 0 if this is a top-level organisation.
parent - hierarchy_organisation_organisation The parent organisation in the hierarchy. Null if a top-level item.
children - [hierarchy_organisation_organisation!]! Collection of organisations that are immediately below this one in the framework hierarchy. Empty if this organisation has no children.
typeid - core_id The id of the organisation type, or 0 if this is a generic organisation.
type - hierarchy_organisation_type Organisation type object.
timemodified - core_date! Timestamp of when the hierarchy item type was last modified. Available since Totara 19.0.1.
Arguments
format - core_date_format
visible - Boolean! Flag determining whether the organisation is visible to end users or not.
custom_fields - [totara_customfield_field!] Custom fields relating to the organisation
Example
{
  "id": 4,
  "fullname": "xyz789",
  "idnumber": "abc123",
  "shortname": "xyz789",
  "description": "abc123",
  "frameworkid": 4,
  "framework": hierarchy_organisation_framework,
  "path": "xyz789",
  "parentid": 4,
  "parent": hierarchy_organisation_organisation,
  "children": [hierarchy_organisation_organisation],
  "typeid": 4,
  "type": hierarchy_organisation_type,
  "timemodified": "2022-04-17",
  "visible": true,
  "custom_fields": [totara_customfield_field]
}

hierarchy_organisation_organisation_created_result

Description

Mutation result type returned after creation of a new organisation. Returns the organisation that was created.

Fields
Field Name Description
organisation - hierarchy_organisation_organisation Organisation object for the organisation that was created as part of the operation.
Example
{"organisation": hierarchy_organisation_organisation}

hierarchy_organisation_organisation_deleted_result

Description

Mutation result type returned after deletion of an organisation. Returns the id of deleted organisation if it was deleted successfully.

Fields
Field Name Description
organisation_id - core_id! Internal database id of the organisation that was just deleted from the system.
Example
{"organisation_id": 4}

hierarchy_organisation_organisation_reference

Description

Input for identifying an organisation.

Fields
Input Field Description
id - core_id

Identify an organisation by internal database id.

idnumber - String

Identify an organisation by its idnumber. idnumber is a unique reference used to represent the organisation across multiple systems.

Example
{"id": 4, "idnumber": "xyz789"}

hierarchy_organisation_organisation_result

Description

Query result type returned when querying a single organisation.

Fields
Field Name Description
found - Boolean! Whether the organisation was found. This may return false if the record doesn't exist within Totara or if the API client doesn't have access to the record.
organisation - hierarchy_organisation_organisation Organisation object for the organisation that was requested as part of the operation.
Example
{
  "found": true,
  "organisation": hierarchy_organisation_organisation
}

hierarchy_organisation_organisation_updated_result

Description

Mutation result type returned after updates to an existing organisation. Returns the organisation that was updated.

Fields
Field Name Description
organisation - hierarchy_organisation_organisation Organisation object for the organisation that was updated as part of the operation.
Example
{"organisation": hierarchy_organisation_organisation}

hierarchy_organisation_organisations_filter

Description

Organisation filter

Properties to filter out organisations.

Fields
Input Field Description
framework_id - param_integer

The internal ID of a framework to filter on.

parent_id - param_integer

The internal ID of a parent organisation to filter on.

ids - [param_integer!]

A list of internal IDs of organisations to filter on.

name - param_text

Filter based on the name of the organisations.

type_id - param_integer

The internal ID of a type to filter on.

since_timemodified - core_date

The timestamp of when the organisation was last modified. Handles the following formats: integer timestamp, numeric string or an ISO-8601 string. Available since Totara 19.0.1.

Example
{
  "framework_id": 123,
  "parent_id": 123,
  "ids": [123],
  "name": "This is a string",
  "type_id": 123,
  "since_timemodified": "2022-04-17"
}

hierarchy_organisation_organisations_query

Description

Input type for the organisations query.

Fields
Input Field Description
pagination - core_pagination_input

The pagination object contains information about the number of items to be returned, and the page offset to start from.

sort - [core_sort_input!]

The sort order for the query. The query is currently only able to sort by one order.

filters - hierarchy_organisation_organisations_filter

The filters for querying organisations.

Example
{
  "pagination": core_pagination_input,
  "sort": [core_sort_input],
  "filters": hierarchy_organisation_organisations_filter
}

hierarchy_organisation_organisations_result

Description

Organisation result

Result type for a collection of organisations.

Fields
Field Name Description
items - [hierarchy_organisation_organisation!]! Array of one page of organisations returned by the query.
total - Int! Total number of organisations from this query (across all pages).
next_cursor - String! Cursor to request the next set of results for this query.
Example
{
  "items": [hierarchy_organisation_organisation],
  "total": 987,
  "next_cursor": "xyz789"
}

hierarchy_organisation_type

Description

Organisation type object. An organisation type is a user-defined classification which can be assigned to organisations leading to certain custom fields being available on that organisation.

Fields
Field Name Description
id - core_id! Internal database id of the organisation type.
fullname - String! Organisation type full name.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the organisation type across multiple systems.
shortname - String The short name of the organisation type. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the organisation type.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 4,
  "fullname": "xyz789",
  "idnumber": "abc123",
  "shortname": "xyz789",
  "description": "abc123"
}

hierarchy_organisation_type_reference

Description

Input for identifying an organisation type.

Fields
Input Field Description
id - core_id

Identify an organisation type by internal database id.

idnumber - String

Identify an organisation type by its idnumber. idnumber is a unique reference used to represent the organisation type across multiple systems.

Example
{"id": 4, "idnumber": "abc123"}

hierarchy_organisation_update_organisation_input

Description

Input provided when updating an organisation.

Fields
Input Field Description
fullname - String

Full name of the organisation.

idnumber - String

Unique reference used to represent the organisation across multiple systems.

description - String

Rich-text description of the organisation.

framework - hierarchy_organisation_framework_reference

The organisation framework this organisation belongs to.

parent - hierarchy_organisation_organisation_reference

The parent organisation in the hierarchy.

type - hierarchy_organisation_type_reference

Organisation type.

visible - Boolean

Flag determining whether the organisation is visible to end users or not.

custom_fields - [totara_customfield_input!]

Optional array of organisation type custom field data (each array element describes a single custom field value for this organisation).

Example
{
  "fullname": "abc123",
  "idnumber": "xyz789",
  "description": "xyz789",
  "framework": hierarchy_organisation_framework_reference,
  "parent": hierarchy_organisation_organisation_reference,
  "type": hierarchy_organisation_type_reference,
  "visible": true,
  "custom_fields": [totara_customfield_input]
}

Position Hierarchies

Queries

hierarchy_position_position

Description

Return a specific position.

Arguments
Name Description
reference - hierarchy_position_position_reference! Input object specifying data for the existing position.

Example

Query
query hierarchy_position_position($reference: hierarchy_position_position_reference!) {
  hierarchy_position_position(reference: $reference) {
    found
    position {
      ...hierarchy_position_positionFragment
    }
  }
}
Variables
{"reference": hierarchy_position_position_reference}
Response
{
  "data": {
    "hierarchy_position_position": {
      "found": true,
      "position": hierarchy_position_position
    }
  }
}

hierarchy_position_positions

Description

Return a list of positions.

Arguments
Name Description
query - hierarchy_position_positions_query

Example

Query
query hierarchy_position_positions($query: hierarchy_position_positions_query) {
  hierarchy_position_positions(query: $query) {
    items {
      ...hierarchy_position_positionFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": hierarchy_position_positions_query}
Response
{
  "data": {
    "hierarchy_position_positions": {
      "items": [hierarchy_position_position],
      "total": 987,
      "next_cursor": "xyz789"
    }
  }
}

Mutations

hierarchy_position_create_position

Description

Creates a new position. Please note: creating positions requires the capability 'totara/hierarchy:createposition'

Arguments
Name Description
input - hierarchy_position_create_position_input! Input object specifying data for creating the new position.

Example

Query
mutation hierarchy_position_create_position($input: hierarchy_position_create_position_input!) {
  hierarchy_position_create_position(input: $input) {
    position {
      ...hierarchy_position_positionFragment
    }
  }
}
Variables
{"input": hierarchy_position_create_position_input}
Response
{
  "data": {
    "hierarchy_position_create_position": {
      "position": hierarchy_position_position
    }
  }
}

hierarchy_position_delete_position

Description

Mutation to delete an position. Please note: deleting positions requires the capability 'totara/hierarchy:deleteposition'

Arguments
Name Description
target_position - hierarchy_position_position_reference! Input provided for identifying the position.

Example

Query
mutation hierarchy_position_delete_position($target_position: hierarchy_position_position_reference!) {
  hierarchy_position_delete_position(target_position: $target_position) {
    position_id
  }
}
Variables
{"target_position": hierarchy_position_position_reference}
Response
{"data": {"hierarchy_position_delete_position": {"position_id": 4}}}

hierarchy_position_update_position

Description

Updates a specific target position with new properties. Please note: updating positions requires the capability 'totara/hierarchy:updateposition'

Arguments
Name Description
target_position - hierarchy_position_position_reference! The position that should be updated.
input - hierarchy_position_update_position_input! Input object specifying data for updating the position.

Example

Query
mutation hierarchy_position_update_position(
  $target_position: hierarchy_position_position_reference!,
  $input: hierarchy_position_update_position_input!
) {
  hierarchy_position_update_position(
    target_position: $target_position,
    input: $input
  ) {
    position {
      ...hierarchy_position_positionFragment
    }
  }
}
Variables
{
  "target_position": hierarchy_position_position_reference,
  "input": hierarchy_position_update_position_input
}
Response
{
  "data": {
    "hierarchy_position_update_position": {
      "position": hierarchy_position_position
    }
  }
}

Types

hierarchy_position_create_position_input

Description

Input provided when creating a position.

Fields
Input Field Description
fullname - String!

Full name of the position.

idnumber - String

Unique reference used to represent the position across multiple systems.

description - String

Rich-text description of the position.

framework - hierarchy_position_framework_reference!

The position framework this position belongs to.

parent - hierarchy_position_position_reference

The parent position in the hierarchy.

type - hierarchy_position_type_reference

Position type.

visible - Boolean

Flag determining whether the position is visible to end users or not. If not given, will default to visible.

custom_fields - [totara_customfield_input!]

Optional array of position type custom field data (each array element describes a single custom field value for this position).

Example
{
  "fullname": "xyz789",
  "idnumber": "xyz789",
  "description": "abc123",
  "framework": hierarchy_position_framework_reference,
  "parent": hierarchy_position_position_reference,
  "type": hierarchy_position_type_reference,
  "visible": true,
  "custom_fields": [totara_customfield_input]
}

hierarchy_position_framework

Description

Position framework object. A position framework is a collection of positions arranged in a tree.

Fields
Field Name Description
id - core_id! Internal database id of the position framework.
fullname - String! Full name of the position framework.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position framework across multiple systems.
shortname - String Short name of the position framework, only used if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position framework.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 4,
  "fullname": "abc123",
  "idnumber": "abc123",
  "shortname": "abc123",
  "description": "abc123"
}

hierarchy_position_framework_reference

Description

Input for identifying a position framework.

Fields
Input Field Description
id - core_id

Identify a position framework by internal database id.

idnumber - String

Identify a position framework by its idnumber. idnumber is a unique reference used to represent the position framework across multiple systems.

Example
{"id": 4, "idnumber": "abc123"}

hierarchy_position_position

Description

Position item object.

The position structure defines the job roles that a company has defined.

Fields
Field Name Description
id - core_id! Internal database id of the position.
fullname - String! Full name of the position.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position across multiple systems.
shortname - String The short name of the position. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position.
Arguments
format - core_format

Output format this field should be formatted for. Please note: RAW format is only available to users with the capability 'totara/hierarchy:updateposition' in the system context, as its purpose is for editing.

frameworkid - core_id The internal database id of the position framework this position belongs to. Please note: viewing this position's frameworkid requires the capability 'totara/hierarchy:viewpositionframeworks'
framework - hierarchy_position_framework The position framework this position belongs to. Please note: viewing this position's framework requires the capability 'totara/hierarchy:viewpositionframeworks'
path - String! An ordered list of parent database ids for this position, indicating the hierarchy of parent items. Includes the current item and separated by forward slashes, e.g. item with id=6 might be: /1/4/6 This is a computed value.
parentid - core_id The id of this position's immediate parent in the framework hierarchy. Set to 0 if this is a top-level position.
parent - hierarchy_position_position The parent position in the hierarchy. Null if a top-level item.
children - [hierarchy_position_position!]! Collection of positions that are immediately below this one in the framework hierarchy. Empty if this position has no children.
typeid - core_id The id of the position type, or 0 if this is a generic position.
type - hierarchy_position_type Position type object.
timemodified - core_date! Timestamp of when the position was last modified. Available since Totara 19.0.1.
Arguments
format - core_date_format
visible - Boolean! Flag determining whether the position is visible to users or not.
custom_fields - [totara_customfield_field!] Custom fields relating to the position
Example
{
  "id": 4,
  "fullname": "abc123",
  "idnumber": "abc123",
  "shortname": "xyz789",
  "description": "abc123",
  "frameworkid": 4,
  "framework": hierarchy_position_framework,
  "path": "abc123",
  "parentid": 4,
  "parent": hierarchy_position_position,
  "children": [hierarchy_position_position],
  "typeid": 4,
  "type": hierarchy_position_type,
  "timemodified": "2022-04-17",
  "visible": true,
  "custom_fields": [totara_customfield_field]
}

hierarchy_position_position_created_result

Description

Mutation result type returned after creation of a new position. Returns the position that was created.

Fields
Field Name Description
position - hierarchy_position_position Position object for the position that was created as part of the operation.
Example
{"position": hierarchy_position_position}

hierarchy_position_position_deleted_result

Description

Mutation result type returned after deletion of a position. Returns the id of deleted position if it was deleted successfully.

Fields
Field Name Description
position_id - core_id! Internal database id of the position that was just deleted from the system.
Example
{"position_id": 4}

hierarchy_position_position_reference

Description

Input for identifying a position.

Fields
Input Field Description
id - core_id

Identify a position by internal database id.

idnumber - String

Identify a position by its idnumber. idnumber is a unique reference used to represent the position across multiple systems.

Example
{"id": 4, "idnumber": "abc123"}

hierarchy_position_position_result

Description

Represents a single position result.

Fields
Field Name Description
found - Boolean Whether or not the position is found. This may return false if the record doesn't exist within Totara or if the API client doesn't have access to the record.
position - hierarchy_position_position The found position. This will be null if the position couldn't be found.
Example
{"found": true, "position": hierarchy_position_position}

hierarchy_position_position_updated_result

Description

Mutation result type returned after updates to an existing position. Returns the position that was updated.

Fields
Field Name Description
position - hierarchy_position_position Position object for the position that was updated as part of the operation.
Example
{"position": hierarchy_position_position}

hierarchy_position_positions_filter

Description

Position filter

Properties to filter out positions.

Fields
Input Field Description
framework_id - param_integer

The internal ID of a framework to filter on.

parent_id - param_integer

The internal ID of a parent position to filter on.

ids - [param_integer!]

A list of internal IDs of positions to filter on.

name - param_text

Filter based on the name of the positions.

type_id - param_integer

The internal ID of a type to filter on.

since_timemodified - core_date

The timestamp of when the position was last modified. Handles the following formats: integer timestamp, numeric string or an ISO-8601 string. Available since Totara 19.0.1.

Example
{
  "framework_id": 123,
  "parent_id": 123,
  "ids": [123],
  "name": "This is a string",
  "type_id": 123,
  "since_timemodified": "2022-04-17"
}

hierarchy_position_positions_query

Description

Input type for the positions query.

Fields
Input Field Description
pagination - core_pagination_input

The pagination object contains information about the number of items to be returned, and the page offset to start from.

sort - [core_sort_input!]

The sort order for the query. The query is currently only able to sort by one order.

filters - hierarchy_position_positions_filter

The filters for querying positions.

Example
{
  "pagination": core_pagination_input,
  "sort": [core_sort_input],
  "filters": hierarchy_position_positions_filter
}

hierarchy_position_positions_result

Description

Position result

Result type for a collection of positions.

Fields
Field Name Description
items - [hierarchy_position_position!]! Array of one page of positions returned by the query.
total - Int! Total number of positions from this query (across all pages).
next_cursor - String! Cursor to request the next set of results for this query.
Example
{
  "items": [hierarchy_position_position],
  "total": 987,
  "next_cursor": "abc123"
}

hierarchy_position_type

Description

Position type object. A position type is a user-defined classification which can be assigned to positions leading to certain custom fields being available on that position.

Fields
Field Name Description
id - core_id! Internal database id of the position type.
fullname - String! Position type full name.
Arguments
format - core_format

Output format this field should be formatted for.

idnumber - String Unique reference used to represent the position type across multiple systems.
shortname - String The short name of the position type. Only used as additional information if admin setting 'showhierarchyshortnames' is enabled.
Arguments
format - core_format

Output format this field should be formatted for.

description - String Rich-text description of the position type.
Arguments
format - core_format

Output format this field should be formatted for.

Example
{
  "id": 4,
  "fullname": "xyz789",
  "idnumber": "xyz789",
  "shortname": "xyz789",
  "description": "xyz789"
}

hierarchy_position_type_reference

Description

Input for identifying a position type.

Fields
Input Field Description
id - core_id

Identify a position type by internal database id.

idnumber - String

Identify a position type by its idnumber. idnumber is a unique reference used to represent the position type across multiple systems.

Example
{"id": 4, "idnumber": "xyz789"}

hierarchy_position_update_position_input

Description

Input provided when updating a position.

Fields
Input Field Description
fullname - String

Full name of the position.

idnumber - String

Unique reference used to represent the position across multiple systems.

description - String

Rich-text description of the position.

framework - hierarchy_position_framework_reference

The position framework this position belongs to.

parent - hierarchy_position_position_reference

The parent position in the hierarchy.

type - hierarchy_position_type_reference

Position type.

visible - Boolean

Flag determining whether the position is visible to end users or not.

custom_fields - [totara_customfield_input!]

Optional array of position type custom field data (each array element describes a single custom field value for this position).

Example
{
  "fullname": "xyz789",
  "idnumber": "xyz789",
  "description": "abc123",
  "framework": hierarchy_position_framework_reference,
  "parent": hierarchy_position_position_reference,
  "type": hierarchy_position_type_reference,
  "visible": true,
  "custom_fields": [totara_customfield_input]
}

Report Builder

Queries

totara_reportbuilder_get_report

Description

Query to fetch a paginated set of report data. This report will contain the same data as a report viewed on the site, meaning that it will hide columns that are hidden by default, and be pre-filtered by any default saved searches.

Arguments
Name Description
input - totara_reportbuilder_get_report_input! The request input that must be provided for the query.

Example

Query
query totara_reportbuilder_get_report($input: totara_reportbuilder_get_report_input!) {
  totara_reportbuilder_get_report(input: $input) {
    report_metadata {
      ...totara_reportbuilder_report_metadataFragment
    }
    report_pagination {
      ...totara_reportbuilder_report_paginationFragment
    }
    columns {
      ...totara_reportbuilder_report_columnFragment
    }
    rows {
      ...totara_reportbuilder_report_rowFragment
    }
  }
}
Variables
{"input": totara_reportbuilder_get_report_input}
Response
{
  "data": {
    "totara_reportbuilder_get_report": {
      "report_metadata": totara_reportbuilder_report_metadata,
      "report_pagination": totara_reportbuilder_report_pagination,
      "columns": [totara_reportbuilder_report_column],
      "rows": [totara_reportbuilder_report_row]
    }
  }
}

Types

totara_reportbuilder_format_input

Description

Input type for custom formats

Fields
Input Field Description
column - String!

The column to apply the format to, in lowercase, and the form of " _ ". This is the same column that will be returned in the totara_reportbuilder_report_column.key field

formatter - totara_reportbuilder_supported_column_formatter!

The ENUM value of the formatter to use for the column. Using an incorrect formatter for a column will return an exception.

target_format - totara_reportbuilder_supported_target_format!

The format to convert the column value to. This is the format type that will be passed to the formatter. Using an invalid target format for the formatter type will return an exception.

Example
{
  "column": "xyz789",
  "formatter": "DATE",
  "target_format": "ISO8601"
}

totara_reportbuilder_get_report_input

Description

Input provided when requesting report builder data

Fields
Input Field Description
report_id - core_id!

The id of the report you want the data from. Required.

saved_search_id - core_id

The id of an optional saved search to apply. Optional. In order to use the saved search, it must be a shared search, or owned by the API user. If an invalid saved search ID is provided, the API will return an exception

page - Int

Which page of results you want. Optional, defaults to page 1. Note that page size is configured in the report settings. Result will be empty if you request a page beyond the last page.

sort_by - core_sort_input

Optional. An array containing the column and direction by which the report should be sorted. We only support sorting by one column at a time. We expect the column to be in the format _ , e.g. course_courselink to sort by Course Name

display_report_pagination - Boolean

Optional. Get the report pagination information with the total record count and the next cursor. Performing the record count is computationally expensive, so we will only do it when this flag is set to true.

custom_formats - [totara_reportbuilder_format_input!]

Optional. An array of custom formats that should be applied to the associated columns. See the input type for more details.

Example
{
  "report_id": 4,
  "saved_search_id": 4,
  "page": 987,
  "sort_by": core_sort_input,
  "display_report_pagination": true,
  "custom_formats": [totara_reportbuilder_format_input]
}

totara_reportbuilder_get_report_results

Description

Custom query return type. See query resolver for details.

Fields
Field Name Description
report_metadata - totara_reportbuilder_report_metadata! Information about the report itself. This object will always be available.
report_pagination - totara_reportbuilder_report_pagination! Information about the number of pages in the report, and the next page number. This object will always be available, but its fields may be null.
columns - [totara_reportbuilder_report_column!]! The columns in the report. This object will always be available. A report must have at least one column.
rows - [totara_reportbuilder_report_row!]! The report rows containing the report data. This object will always be available. If there are no rows, the data field will be an empty array.
Example
{
  "report_metadata": totara_reportbuilder_report_metadata,
  "report_pagination": totara_reportbuilder_report_pagination,
  "columns": [totara_reportbuilder_report_column],
  "rows": [totara_reportbuilder_report_row]
}

totara_reportbuilder_report_column

Description

Custom type for a report column. Columns that are hidden by default on a report are excluded.

Fields
Field Name Description
key - String! The database name for the column
label - String The human-readable name for the column
Example
{
  "key": "abc123",
  "label": "abc123"
}

totara_reportbuilder_report_metadata

Description

Custom type for report metadata. This field contains information from the General tab of the report editor.

Fields
Field Name Description
title - String! The presentable report name that is displayed to a user. The title field is an HTML text input field of 30 characters; we do not expect any formatting.
Arguments
format - core_format
abstract - String The summary of the report; a brief description. The abstract field is an HTML textarea, so it only supports plain text, and cannot have HTML tags. When the report abstract is empty, this field can be null or an empty string.
Arguments
format - core_format
description - String The long-format description of the report. The description field is an atto editor, so it is formatted in HTML by default. When the report description is left blank, we expect a null value.
Arguments
format - core_format
records_per_page - Int! The number of records that will be returned on this page of the report.
Example
{
  "title": "xyz789",
  "abstract": "abc123",
  "description": "abc123",
  "records_per_page": 987
}

totara_reportbuilder_report_pagination

Description

Custom type for the report pagination.

Fields
Field Name Description
next_cursor - String The next page after this one. If there are no more pages, this value will be null. If we did not do the pagination calculation, this will be null.
total_pages - Int Total number of pages returned by the filtered report This is not the number of pages returned by the query, but the total number of pages in the report after applying filters. If there are no records in the report, this value will be 0. If we did not do the pagination calculation, this value will be null.
Example
{
  "next_cursor": "xyz789",
  "total_pages": 987
}

totara_reportbuilder_report_row

Description

Custom type for report rows. See the type resolver for details. A row provides the unlabelled data for each column in order. Columns that are hidden by default on a report are excluded.

Fields
Field Name Description
data - [String]! An array of data for each row in the report table. Note that fields containing files such as summary fields cannot be rendered here, and image tags will be replaced with empty strings.
Example
{"data": ["abc123"]}

totara_reportbuilder_supported_column_formatter

Description

Available column formatters for different data types. It is important to note that applying the incorrect formatter to a field will not give the desired result. Additionally, some fields cannot be effectively formatted by HTML if they are cleaned when they are saved to the database.

Values
Enum Value Description

DATE

The DATE formatter is for date fields. The default formatter gives values in timestamps.

STRING

The STRING formatter is for short fields such as course names or user names. HTML tags are not saved for these fields.

TEXT

The TEXT formatter is for longer fields that retain formatting, such as Atto or Weka editors. These fields are most likely to have HTML formatting.

TEXTAREA

The TEXTAREA formatter is for longer fields that use the textarea HTML tag. These fields typically do not save HTML formatting.
Example
"DATE"

totara_reportbuilder_supported_target_format

Description

Valid formats available for each formatter. Each format describes the formatter for which it is valid.

Values
Enum Value Description

ISO8601

ISO8601 format. Available for DATE formatters.

TIMESTAMP

An integer time. Available for DATE formatters.

RAW

The field exactly as it is saved in the database. Available for STRING, TEXT, and TEXTAREA formatters.

PLAIN

The field stripped of whitespace and HTML tags. Available for STRING, TEXT, and TEXTAREA formatters.

HTML

The field with whitespace and HTML preserved where possible. Available for STRING, TEXT, and TEXTAREA formatters.

MOBILE

JSON-formatted data where possible, otherwise plain. Available for TEXT formatters.
Example
"ISO8601"

Seminar

Queries

mod_facetoface_event

Description

Get a single seminar event.

Response

Returns a mod_facetoface_event_result!

Arguments
Name Description
event - mod_facetoface_event_reference! Reference for a single seminar event.

Example

Query
query mod_facetoface_event($event: mod_facetoface_event_reference!) {
  mod_facetoface_event(event: $event) {
    event {
      ...mod_facetoface_eventFragment
    }
  }
}
Variables
{"event": mod_facetoface_event_reference}
Response
{
  "data": {
    "mod_facetoface_event": {
      "event": mod_facetoface_event
    }
  }
}

mod_facetoface_event_user_booking

Description

Gets the user booking for a given seminar event.

Arguments
Name Description
user - core_user_user_reference! User reference for a single user.
event - mod_facetoface_event_reference! Event reference for a single event.

Example

Query
query mod_facetoface_event_user_booking(
  $user: core_user_user_reference!,
  $event: mod_facetoface_event_reference!
) {
  mod_facetoface_event_user_booking(
    user: $user,
    event: $event
  ) {
    found
    booking {
      ...mod_facetoface_event_user_bookingFragment
    }
  }
}
Variables
{
  "user": core_user_user_reference,
  "event": mod_facetoface_event_reference
}
Response
{
  "data": {
    "mod_facetoface_event_user_booking": {
      "found": true,
      "booking": mod_facetoface_event_user_booking
    }
  }
}

mod_facetoface_events

Description

Get a list of events.

Response

Returns a mod_facetoface_events_result!

Arguments
Name Description
query - mod_facetoface_events_query The parameters for the events query, including pagination, sorting and filters.

Example

Query
query mod_facetoface_events($query: mod_facetoface_events_query) {
  mod_facetoface_events(query: $query) {
    items {
      ...mod_facetoface_eventFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": mod_facetoface_events_query}
Response
{
  "data": {
    "mod_facetoface_events": {
      "items": [mod_facetoface_event],
      "total": 123,
      "next_cursor": "xyz789"
    }
  }
}

mod_facetoface_seminar

Description

Get a single seminar.

Response

Returns a mod_facetoface_seminar_result!

Arguments
Name Description
seminar - mod_facetoface_seminar_reference! Reference for a single seminar.

Example

Query
query mod_facetoface_seminar($seminar: mod_facetoface_seminar_reference!) {
  mod_facetoface_seminar(seminar: $seminar) {
    seminar {
      ...mod_facetoface_seminarFragment
    }
  }
}
Variables
{"seminar": mod_facetoface_seminar_reference}
Response
{
  "data": {
    "mod_facetoface_seminar": {
      "seminar": mod_facetoface_seminar
    }
  }
}

mod_facetoface_seminars_in_course

Description

Get a list of seminars within a course.

Arguments
Name Description
course - core_course_course_reference! The course to search for seminars in.
query - mod_facetoface_seminars_in_course_query The parameters for the events query, including sorting and filters.

Example

Query
query mod_facetoface_seminars_in_course(
  $course: core_course_course_reference!,
  $query: mod_facetoface_seminars_in_course_query
) {
  mod_facetoface_seminars_in_course(
    course: $course,
    query: $query
  ) {
    items {
      ...mod_facetoface_seminarFragment
    }
    total
  }
}
Variables
{
  "course": core_course_course_reference,
  "query": mod_facetoface_seminars_in_course_query
}
Response
{
  "data": {
    "mod_facetoface_seminars_in_course": {
      "items": [mod_facetoface_seminar],
      "total": 123
    }
  }
}

Mutations

mod_facetoface_event_cancel_user_booking

Description

Cancel a user booking/signup for a seminar event.

Arguments
Name Description
input - mod_facetoface_event_cancel_user_booking_input! Input for cancelling a seminar event booking/signup.

Example

Query
mutation mod_facetoface_event_cancel_user_booking($input: mod_facetoface_event_cancel_user_booking_input!) {
  mod_facetoface_event_cancel_user_booking(input: $input) {
    cancellation_errors {
      ...mod_facetoface_event_user_booking_state_errorFragment
    }
    success
    booking {
      ...mod_facetoface_event_user_bookingFragment
    }
  }
}
Variables
{"input": mod_facetoface_event_cancel_user_booking_input}
Response
{
  "data": {
    "mod_facetoface_event_cancel_user_booking": {
      "cancellation_errors": [
        mod_facetoface_event_user_booking_state_error
      ],
      "success": true,
      "booking": mod_facetoface_event_user_booking
    }
  }
}

mod_facetoface_event_create_user_booking

Description

Create a user booking/signup for a seminar event. This service attempts to create a user booking in any one of the states of BOOKED, REQUESTED, REQUESTED_ROLE, or WAITLISTED. See mod_facetoface_booking_state_key for full definitions of states.

Arguments
Name Description
input - mod_facetoface_event_create_user_booking_input! Input for creating a seminar event booking/signup.

Example

Query
mutation mod_facetoface_event_create_user_booking($input: mod_facetoface_event_create_user_booking_input!) {
  mod_facetoface_event_create_user_booking(input: $input) {
    created
    booking_errors {
      ...mod_facetoface_event_user_booking_state_errorFragment
    }
    booking {
      ...mod_facetoface_event_user_bookingFragment
    }
  }
}
Variables
{"input": mod_facetoface_event_create_user_booking_input}
Response
{
  "data": {
    "mod_facetoface_event_create_user_booking": {
      "created": true,
      "booking_errors": [
        mod_facetoface_event_user_booking_state_error
      ],
      "booking": mod_facetoface_event_user_booking
    }
  }
}

Types

mod_facetoface_booking_state

Description

The exact state of a booking.

Fields
Field Name Description
key - mod_facetoface_booking_state_key! Used to determine the state type.
title - String! User-facing title of the booking. This uses a language string and may change depending on language settings.
enter_state_message - String User-facing message for showing when entering the state. This uses a language string and may change depending on language settings. Null if the state is not associated with a signup (e.g., in mod_facetoface_event_user_booking_state_error).
Example
{
  "key": "BOOKED",
  "title": "xyz789",
  "enter_state_message": "abc123"
}

mod_facetoface_booking_state_key

Description

Represents a booking state type.

Values
Enum Value Description

BOOKED

User is booked and confirmed to attend the event.

DECLINED

Booking request is declined.

EVENT_CANCELLED

The event is cancelled.

FULLY_ATTENDED

User attended the entire event.

PARTIALLY_ATTENDED

User attended part of the event.

UNABLE_TO_ATTEND

User indicated they are unable to attend the event.

NO_SHOW

User did not attend the event.

REQUESTED

Booking is requested and pending approval.

REQUESTED_ADMIN

Booking is requested and pending admin approval.

REQUESTED_ROLE

Booking is requested and pending role approval.

USER_CANCELLED

User cancelled their booking.

WAITLISTED

User is on the waitlist for the event.

NOT_SET

Booking state has not been set.

UNKNOWN

Unknown booking state.
Example
"BOOKED"

mod_facetoface_event

Description

Represents a seminar event.

Fields
Field Name Description
id - core_id! Internal database ID of the event.
timecreated - core_date! The time the event was created.
Arguments
format - core_date_format
timemodified - core_date! The time the event was last modified.
Arguments
format - core_date_format
seminar_id - Int! The ID of the seminar the event belongs to.
allow_cancellations - mod_facetoface_event_allow_cancellations The cancellation behaviour for the event.
cancellation_cutoff - Int The number of seconds before the session starts that a user can cancel their booking.
details - String Details of the event.
Arguments
format - core_text_format
cost_normal - String Regular cost for event entry.
cost_discount - String Discounted cost for event entry.
registration_time_start - core_date The time when registration for the event opens.
Arguments
format - core_date_format
registration_time_end - core_date The time when registration for the event closes.
Arguments
format - core_date_format
seats_total - Int! The total number of seats for the event. A value of 0 means unlimited.
seats_booked - Int! Number of seats which have been booked.
seats_available - Int Number of seats which are available to be booked. Waitlisting does not affect this value. Null if unlimited.
sessions - [mod_facetoface_session!]! A list of sessions associated with the event.
custom_fields - [totara_customfield_field!] The custom fields associated with the event. Will be null if the custom fields have not been loaded.
start_date - core_date! Start date of the event. Based on the earliest session's start date.
Arguments
format - core_date_format
finish_date - core_date! Finish date of the event. Based on the latest session's end date.
Arguments
format - core_date_format
seminar - mod_facetoface_seminar! The seminar the event belongs to.
Example
{
  "id": 4,
  "timecreated": "2022-04-17",
  "timemodified": "2022-04-17",
  "seminar_id": 987,
  "allow_cancellations": "NEVER",
  "cancellation_cutoff": 123,
  "details": "xyz789",
  "cost_normal": "xyz789",
  "cost_discount": "xyz789",
  "registration_time_start": "2022-04-17",
  "registration_time_end": "2022-04-17",
  "seats_total": 123,
  "seats_booked": 123,
  "seats_available": 987,
  "sessions": [mod_facetoface_session],
  "custom_fields": [totara_customfield_field],
  "start_date": "2022-04-17",
  "finish_date": "2022-04-17",
  "seminar": mod_facetoface_seminar
}

mod_facetoface_event_allow_cancellations

Description

Defines the available options for allowing cancellations in events.

Values
Enum Value Description

NEVER

Cancellations are not allowed.

ANY_TIME

Cancellations can be made at any time.

CUT_OFF

Cancellations are allowed until the specified cancellation_cutoff time.
Example
"NEVER"

mod_facetoface_event_cancel_user_booking_input

Description

Input provided when cancelling a seminar event user booking.

Fields
Input Field Description
user - core_user_user_reference!

Identifies the user associated with a signup.

event - mod_facetoface_event_reference!

Identifies the event associated with a signup.

cancellation_custom_fields - [totara_customfield_input!]

List of cancellation custom fields (each array element describes a single custom field value).

Example
{
  "user": core_user_user_reference,
  "event": mod_facetoface_event_reference,
  "cancellation_custom_fields": [totara_customfield_input]
}

mod_facetoface_event_cancel_user_booking_result

Description

Result for the event cancel user booking mutation.

Fields
Field Name Description
cancellation_errors - [mod_facetoface_event_user_booking_state_error!] When switching the user's booking to the cancelled state fails, state errors and codes will be provided. E.g. the event is in the past or the event is cancelled.
success - Boolean Whether or not the cancellation was successful.
booking - mod_facetoface_event_user_booking! The user's booking.
Example
{
  "cancellation_errors": [
    mod_facetoface_event_user_booking_state_error
  ],
  "success": true,
  "booking": mod_facetoface_event_user_booking
}

mod_facetoface_event_create_user_booking_input

Description

Input provided when creating a seminar event user booking.

Fields
Input Field Description
event - mod_facetoface_event_reference!

Reference for the seminar event to be booked.

user - core_user_user_reference!

Reference for the user to be booked.

custom_fields - [totara_customfield_input!]

Optional array of seminar event booking custom field data (Sign-up custom fields). Each array element describes a single custom field value for this seminar event user booking.

Example
{
  "event": mod_facetoface_event_reference,
  "user": core_user_user_reference,
  "custom_fields": [totara_customfield_input]
}

mod_facetoface_event_create_user_booking_result

Description

Result for the create seminar event user booking mutation.

Fields
Field Name Description
created - Boolean! Whether or not the user booking was able to be successfully created.
booking_errors - [mod_facetoface_event_user_booking_state_error!] When attempting to book the user for the event and the booking fails, state errors and codes will be provided. E.g. the event is in the past or the event is over capacity. Null when the booking was successful.
booking - mod_facetoface_event_user_booking The user's booking for the event. Null if a booking could not be created.
Example
{
  "created": true,
  "booking_errors": [
    mod_facetoface_event_user_booking_state_error
  ],
  "booking": mod_facetoface_event_user_booking
}

mod_facetoface_event_reference

Description

Reference for a single seminar event.

Fields
Input Field Description
id - core_id!

The ID of the seminar event.

Example
{"id": 4}

mod_facetoface_event_result

Description

Result for the seminar event query.

Fields
Field Name Description
event - mod_facetoface_event The seminar event.
Example
{"event": mod_facetoface_event}

mod_facetoface_event_status

Description

Event status filters.

Values
Enum Value Description

CANCELLED

Cancelled events.

ACTIVE

Active events (events which have not been cancelled).

BOTH

Both active and cancelled events.
Example
"CANCELLED"

mod_facetoface_event_tense

Description

Event tense filters.

Values
Enum Value Description

PAST

Past events from the current time. Includes all events which finish on or before the current time.

FUTURE

Future events from the current time. Includes all events which start after the current time.

BOTH

Both past and future events.
Example
"PAST"

mod_facetoface_event_user_booking

Description

The booking details that are associated with an event.

Fields
Field Name Description
custom_fields - [totara_customfield_field!] Custom fields associated with the user's booking (sign-up custom fields). Will be null if the custom fields have not been loaded.
cancellation_custom_fields - [totara_customfield_field!] Custom fields associated with the user's cancellation (user cancellation custom fields). Will be null if the custom fields have not been loaded.
user - core_user User associated with the booking. Null when the user does not exist or you do not have permissions to view the user.
event - mod_facetoface_event! Event associated with the booking.
booked - Boolean!

If true, the user is booked for the event. The user's booking is considered as booked when in any of the following states:

  • REQUESTED,
  • REQUESTED_ROLE,
  • REQUESTED_ADMIN,
  • WAITLISTED,
  • BOOKED
state - mod_facetoface_booking_state! The state the booking is in (booked, cancelled, requested, etc.).
Example
{
  "custom_fields": [totara_customfield_field],
  "cancellation_custom_fields": [
    totara_customfield_field
  ],
  "user": core_user,
  "event": mod_facetoface_event,
  "booked": true,
  "state": mod_facetoface_booking_state
}

mod_facetoface_event_user_booking_result

Description

Result for the booking query

Fields
Field Name Description
found - Boolean! Whether a booking for the user for the event was found or not.
booking - mod_facetoface_event_user_booking The booking for the user for the event. Null if a booking could not be found.
Example
{
  "found": true,
  "booking": mod_facetoface_event_user_booking
}

mod_facetoface_event_user_booking_state_error

Description

Error returned based on why a booking state cannot be changed.

Fields
Field Name Description
state - mod_facetoface_booking_state! The booking state associated with the error.
message - String! Human readable string describing the error.
code - String! An error code representing the error.
Example
{
  "state": mod_facetoface_booking_state,
  "message": "xyz789",
  "code": "xyz789"
}

mod_facetoface_events_filters

Description

Events filters.

Fields
Input Field Description
course_id - core_id

Retrieve all events belonging to a course.

seminar_id - core_id

Retrieve all events belonging to a seminar.

event_ids - [core_id!]

Events to retrieve by ID.

status - mod_facetoface_event_status

Whether events are active, cancelled or both.

Defaults to both.

tense - mod_facetoface_event_tense

Whether events start in the future, past or both.

Defaults to both past and future events.

starts_after - core_date

Only events which start after a given date time.

Handles the following formats: integer timestamp, numeric string or an ISO-8601 string.

finishes_on_or_before - core_date

Only events which finishes on or before a given date time.

Handles the following formats: integer timestamp, numeric string or an ISO-8601 string.

min_seats_available - Int

Only include events that have at least the specified minimum number of available seats.

since_timemodified - core_date

Only events which have been modified after a given date time.

Handles the following formats: integer timestamp, numeric string or an ISO-8601 string.

Example
{
  "course_id": 4,
  "seminar_id": 4,
  "event_ids": [4],
  "status": "CANCELLED",
  "tense": "PAST",
  "starts_after": "2022-04-17",
  "finishes_on_or_before": "2022-04-17",
  "min_seats_available": 987,
  "since_timemodified": "2022-04-17"
}

mod_facetoface_events_query

Description

Events query input. Specifies pagination, filters and sorting.

Fields
Input Field Description
pagination - core_pagination_input

Pagination input for this query.

Note: Only cursor-based pagination is supported. The page field is not applicable and will be ignored.

filters - mod_facetoface_events_filters

Defines the filters to search by.

sort - [core_sort_input!]

Defines the sort order for the results. The following columns may be used for sorting:

  • id
  • timecreated
  • timemodified
  • seminar_id
  • cost_normal
  • cost_discount
  • registration_time_start
  • registration_time_finish

Note: Currently, sorting is limited to a single column at a time.

Example
{
  "pagination": core_pagination_input,
  "filters": mod_facetoface_events_filters,
  "sort": [core_sort_input]
}

mod_facetoface_events_result

Description

Defines the result of the events query.

Fields
Field Name Description
items - [mod_facetoface_event!]! A list of events.
total - Int!
next_cursor - String!
Example
{
  "items": [mod_facetoface_event],
  "total": 123,
  "next_cursor": "xyz789"
}

mod_facetoface_room

Fields
Field Name Description
id - core_id! Internal database ID of the room.
name - String! The name of the room.
capacity - Int! The number of seats in the room.
allow_conflicts - Boolean! Whether the room can be booked for multiple events at the same time.
description - String The description of the room.
Arguments
format - core_text_format
url - String The URL of the room if it is a virtual room.
custom_fields - [totara_customfield_field!] The custom fields associated with the room. Will be null if the custom fields have not been loaded.
timecreated - core_date! The time the event was created.
Arguments
format - core_date_format
timemodified - core_date! The time the event was last modified.
Arguments
format - core_date_format
Example
{
  "id": 4,
  "name": "xyz789",
  "capacity": 123,
  "allow_conflicts": true,
  "description": "abc123",
  "url": "xyz789",
  "custom_fields": [totara_customfield_field],
  "timecreated": "2022-04-17",
  "timemodified": "2022-04-17"
}

mod_facetoface_seminar

Description

Represents a seminar.

Fields
Field Name Description
id - core_id! Internal database ID of the seminar.
shortname - String Short name for the seminar.
name - String Regular name for the seminar.
description - String Description for the seminar.
Arguments
format - core_text_format
timecreated - core_date The time the session was created.
Arguments
format - core_date_format
timemodified - core_date! The time the session was last modified.
Arguments
format - core_date_format
course_id - core_id! The ID of the course associated with the seminar.
events - [mod_facetoface_event!]! The events associated with the seminar. Note: Resolving events, sessions and rooms can be expensive when resolving multiple seminars.
Example
{
  "id": 4,
  "shortname": "xyz789",
  "name": "xyz789",
  "description": "xyz789",
  "timecreated": "2022-04-17",
  "timemodified": "2022-04-17",
  "course_id": 4,
  "events": [mod_facetoface_event]
}

mod_facetoface_seminar_reference

Description

Reference for a single seminar.

Fields
Input Field Description
id - core_id

The ID of the seminar.

Example
{"id": 4}

mod_facetoface_seminar_result

Description

Result for the seminar query.

Fields
Field Name Description
seminar - mod_facetoface_seminar The seminar that was found.
Example
{"seminar": mod_facetoface_seminar}

mod_facetoface_seminars_filters

Description

Seminars filters.

Fields
Input Field Description
ids - [core_id!]

Filters by a specific set of seminar IDs.

since_timemodified - core_date

Filters seminars which have been modified after a given date time. Handles the following formats: integer timestamp, numeric string or an ISO-8601 string.

Example
{
  "ids": [4],
  "since_timemodified": "2022-04-17"
}

mod_facetoface_seminars_in_course_query

Description

Seminars in Course query input. Specifies pagination, filters and sorting.

Fields
Input Field Description
filters - mod_facetoface_seminars_filters

Defines the filters to search by.

sort - [core_sort_input!]

Defines the sort order for the results. The following columns may be used for sorting:

  • id
  • timecreated
  • timemodified
  • shortname

Note: Currently, sorting is limited to a single column at a time.

Example
{
  "filters": mod_facetoface_seminars_filters,
  "sort": [core_sort_input]
}

mod_facetoface_seminars_in_course_result

Description

Defines the result of the seminars in course query.

Fields
Field Name Description
items - [mod_facetoface_seminar!]! A list of seminars.
total - Int!
Example
{"items": [mod_facetoface_seminar], "total": 123}

mod_facetoface_session

Description

Represents a seminar session.

Fields
Field Name Description
id - core_id! Internal database ID of the session.
timestart - core_date The start date/time for the session.
Arguments
format - core_date_format
timefinish - core_date The finish date/time for the session.
Arguments
format - core_date_format
rooms - [mod_facetoface_room!]! The rooms associated with the session.
Example
{
  "id": 4,
  "timestart": "2022-04-17",
  "timefinish": "2022-04-17",
  "rooms": [mod_facetoface_room]
}

Tag

Types

core_tag

Description

Tag type object, containing information about a tag.

Fields
Field Name Description
name - String! Name of tag.
rawname - String! Rawname of tag.
Example
{"name": "education", "rawname": "Education"}

Totara goals

Queries

perform_goal_get_goal_tasks

Description

A query to get the tasks for a specified goal.

Arguments
Name Description
goal_reference - perform_goal_reference! Input value(s) for identifying a goal: id and/or id_number.

Example

Query
query perform_goal_get_goal_tasks($goal_reference: perform_goal_reference!) {
  perform_goal_get_goal_tasks(goal_reference: $goal_reference) {
    goal_id
    tasks {
      ...perform_goal_goal_taskFragment
    }
    total
    completed
  }
}
Variables
{"goal_reference": perform_goal_reference}
Response
{
  "data": {
    "perform_goal_get_goal_tasks": {
      "goal_id": 4,
      "tasks": [perform_goal_goal_task],
      "total": 987,
      "completed": 987
    }
  }
}

perform_goal_user_goals

Description

A query to fetch the available goals for a user.

Response

Returns a perform_goal_user_goals_result!

Arguments
Name Description
input - perform_goal_user_goals_input! Filter and pagination parameters for the user goals query.

Example

Query
query perform_goal_user_goals($input: perform_goal_user_goals_input!) {
  perform_goal_user_goals(input: $input) {
    items {
      ...perform_goal_user_goals_result_itemFragment
    }
    total
    next_cursor
    has_goals
    success
    errors {
      ...perform_goal_operation_errorFragment
    }
  }
}
Variables
{"input": perform_goal_user_goals_input}
Response
{
  "data": {
    "perform_goal_user_goals": {
      "items": [perform_goal_user_goals_result_item],
      "total": 123,
      "next_cursor": "abc123",
      "has_goals": true,
      "success": true,
      "errors": perform_goal_operation_error
    }
  }
}

perform_goal_view_goal

Description

A query to fetch information about a single goal.

Response

Returns a perform_goal_view_result!

Arguments
Name Description
goal_reference - perform_goal_reference! Input value(s) for identifying a goal: id and/or id_number.

Example

Query
query perform_goal_view_goal($goal_reference: perform_goal_reference!) {
  perform_goal_view_goal(goal_reference: $goal_reference) {
    goal {
      ...perform_goal_goalFragment
    }
    raw {
      ...perform_goal_goal_raw_dataFragment
    }
    permissions {
      ...perform_goal_permissionsFragment
    }
  }
}
Variables
{"goal_reference": perform_goal_reference}
Response
{
  "data": {
    "perform_goal_view_goal": {
      "goal": perform_goal_goal,
      "raw": perform_goal_goal_raw_data,
      "permissions": perform_goal_permissions
    }
  }
}

Mutations

perform_goal_create_goal

Description

An operation to create a new goal, containing the information needed to initialise it for use.

Response

Returns a perform_goal_crud_result!

Arguments
Name Description
input - perform_goal_create_input! Values provided to create a new goal.

Example

Query
mutation perform_goal_create_goal($input: perform_goal_create_input!) {
  perform_goal_create_goal(input: $input) {
    goal {
      ...perform_goal_goalFragment
    }
    raw {
      ...perform_goal_goal_raw_dataFragment
    }
    permissions {
      ...perform_goal_permissionsFragment
    }
  }
}
Variables
{"input": perform_goal_create_input}
Response
{
  "data": {
    "perform_goal_create_goal": {
      "goal": perform_goal_goal,
      "raw": perform_goal_goal_raw_data,
      "permissions": perform_goal_permissions
    }
  }
}

perform_goal_create_goal_task

Description

An operation to create a new goal task, containing the information needed to initialise it for use.

Arguments
Name Description
input - perform_goal_task_create_input! Values provided to create a new goal task.

Example

Query
mutation perform_goal_create_goal_task($input: perform_goal_task_create_input!) {
  perform_goal_create_goal_task(input: $input) {
    goal_task {
      ...perform_goal_goal_taskFragment
    }
    success
    errors {
      ...perform_goal_task_operation_errorFragment
    }
  }
}
Variables
{"input": perform_goal_task_create_input}
Response
{
  "data": {
    "perform_goal_create_goal_task": {
      "goal_task": perform_goal_goal_task,
      "success": true,
      "errors": perform_goal_task_operation_error
    }
  }
}

perform_goal_delete_goal

Description

An operation to delete an existing goal.

Response

Returns a perform_goal_delete_result!

Arguments
Name Description
goal_reference - perform_goal_reference! Input value(s) for identifying a goal.

Example

Query
mutation perform_goal_delete_goal($goal_reference: perform_goal_reference!) {
  perform_goal_delete_goal(goal_reference: $goal_reference) {
    success
  }
}
Variables
{"goal_reference": perform_goal_reference}
Response
{"data": {"perform_goal_delete_goal": {"success": true}}}

perform_goal_delete_goal_task

Description

An operation to delete an existing goal task.

Arguments
Name Description
goal_task_reference - perform_goal_task_reference! Input value(s) for identifying a goal task.

Example

Query
mutation perform_goal_delete_goal_task($goal_task_reference: perform_goal_task_reference!) {
  perform_goal_delete_goal_task(goal_task_reference: $goal_task_reference) {
    success
  }
}
Variables
{"goal_task_reference": perform_goal_task_reference}
Response
{"data": {"perform_goal_delete_goal_task": {"success": true}}}

perform_goal_set_goal_task_progress

Description

An operation to set the progress of a single goal task.

Arguments
Name Description
input - perform_goal_task_set_progress_input! Input value for setting a goal task's progress.

Example

Query
mutation perform_goal_set_goal_task_progress($input: perform_goal_task_set_progress_input!) {
  perform_goal_set_goal_task_progress(input: $input) {
    goal_task {
      ...perform_goal_goal_taskFragment
    }
    success
    errors {
      ...perform_goal_task_operation_errorFragment
    }
  }
}
Variables
{"input": perform_goal_task_set_progress_input}
Response
{
  "data": {
    "perform_goal_set_goal_task_progress": {
      "goal_task": perform_goal_goal_task,
      "success": true,
      "errors": perform_goal_task_operation_error
    }
  }
}

perform_goal_update_goal

Description

An operation to modify an existing goal's information.

Response

Returns a perform_goal_crud_result!

Arguments
Name Description
goal_reference - perform_goal_reference! Input value(s) for identifying a goal.
input - perform_goal_update_input! Values provided for updating a goal.

Example

Query
mutation perform_goal_update_goal(
  $goal_reference: perform_goal_reference!,
  $input: perform_goal_update_input!
) {
  perform_goal_update_goal(
    goal_reference: $goal_reference,
    input: $input
  ) {
    goal {
      ...perform_goal_goalFragment
    }
    raw {
      ...perform_goal_goal_raw_dataFragment
    }
    permissions {
      ...perform_goal_permissionsFragment
    }
  }
}
Variables
{
  "goal_reference": perform_goal_reference,
  "input": perform_goal_update_input
}
Response
{
  "data": {
    "perform_goal_update_goal": {
      "goal": perform_goal_goal,
      "raw": perform_goal_goal_raw_data,
      "permissions": perform_goal_permissions
    }
  }
}

perform_goal_update_goal_task

Description

An operation to update a goal task.

Arguments
Name Description
input - perform_goal_task_update_input! Values provided to create a new goal task.

Example

Query
mutation perform_goal_update_goal_task($input: perform_goal_task_update_input!) {
  perform_goal_update_goal_task(input: $input) {
    goal_task {
      ...perform_goal_goal_taskFragment
    }
    success
    errors {
      ...perform_goal_task_operation_errorFragment
    }
  }
}
Variables
{"input": perform_goal_task_update_input}
Response
{
  "data": {
    "perform_goal_update_goal_task": {
      "goal_task": perform_goal_goal_task,
      "success": true,
      "errors": perform_goal_task_operation_error
    }
  }
}

perform_goal_update_progress

Description

An operation to update an existing goal's progress information, i.e. the goal status and current_value.

Arguments
Name Description
goal_reference - perform_goal_reference! Input value(s) for identifying a goal.
input - perform_goal_update_progress_input! Values to update a goal's progress with.

Example

Query
mutation perform_goal_update_progress(
  $goal_reference: perform_goal_reference!,
  $input: perform_goal_update_progress_input!
) {
  perform_goal_update_progress(
    goal_reference: $goal_reference,
    input: $input
  ) {
    current_value
    status {
      ...perform_goal_statusFragment
    }
  }
}
Variables
{
  "goal_reference": perform_goal_reference,
  "input": perform_goal_update_progress_input
}
Response
{
  "data": {
    "perform_goal_update_progress": {
      "current_value": 987.65,
      "status": perform_goal_status
    }
  }
}

Types

perform_goal_create_input

Description

Input provided when creating a goal. Some fields are required.

Fields
Input Field Description
context_id - core_id

Parent context ID of the goal object.

owner - core_user_user_reference

The user that 'owns' the goal, i.e. is responsible for managing it. Usually the owner will be the same person as the user who initially created the goal. If this field is not included, the default owner will be set to the user making the request.

user - core_user_user_reference

The user who is the subject of the goal, i.e. who the goal is applied to.

name - String!

The display name for the goal.

id_number - String

An external identifier for the goal.

description - String

Comments or a statement about the goal.

start_date - core_date!

The date the goal will commence.

target_type - String

The type of the target for the goal, e.g. date, percentage, currency, number, manual. Current target type is 'date'.

target_date - core_date!

The date the goal is expected to be completed/closed.

target_value - Float!

The expected value for achieving the goal.

current_value - Float

The value towards the goal currently achieved so far.

status - String

The current status of the goal (currently supports the 'not_started', 'in_progress', 'completed', 'cancelled').

plugin_name - String

The module/plugin name (currently supports the 'basic' plugin).

Example
{
  "context_id": 4,
  "owner": core_user_user_reference,
  "user": core_user_user_reference,
  "name": "Display knowledge of 5 sales methods",
  "id_number": "sf_10133",
  "description": "The learner must show knowledge of 5 sales methods.",
  "start_date": 1696289455,
  "target_type": "date",
  "target_date": 1701513055,
  "target_value": 100,
  "current_value": 123.45,
  "status": "in_progress",
  "plugin_name": "basic"
}

perform_goal_crud_result

Description

The result returned from a goal create/update/delete operation.

Fields
Field Name Description
goal - perform_goal_goal! Goal type object, containing information about a personal goal.
raw - perform_goal_goal_raw_data! Goal metadata from a goal create/update/delete operation.
permissions - perform_goal_permissions! Permissions for the current user to manipulate goals.
Example
{
  "goal": perform_goal_goal,
  "raw": perform_goal_goal_raw_data,
  "permissions": perform_goal_permissions
}

perform_goal_delete_result

Description

The result returned from a goal delete operation.

Fields
Field Name Description
success - Boolean! Whether the current goal successfully deleted.
Example
{"success": true}

perform_goal_get_goal_tasks_result

Description

The result returned from a get goal tasks operation.

Fields
Field Name Description
goal_id - core_id! The database ID of the parent goal.
tasks - [perform_goal_goal_task!] The list of goal_task items associated with a goal.
total - Int! Total number of tasks in this goal.
completed - Int! Total number of completed tasks in this goal.
Example
{
  "goal_id": 4,
  "tasks": [perform_goal_goal_task],
  "total": 123,
  "completed": 123
}

perform_goal_goal

Description

Goal type object, containing information about a personal or team goal. All available fields are listed. No fields are required.

Fields
Field Name Description
id - core_id Internal database ID of the goal.
context_id - core_id Parent context ID of the goal object.
category_id - core_id Perform goal category, associates a category name with a goaltype subplugin.
owner - core_user The user that 'owns' the goal, i.e. is responsible for managing it. Usually the owner will be the same person as the user who initially created the goal.
user - core_user The user who is the subject of the goal, i.e. who the goal is applied to.
name - String The display name for the goal.
id_number - String An external identifier for the goal.
description - String Comments or a statement about the goal.
Arguments
format - core_format
assignment_type - String! Goal assignment type, e.g. self, manager, etc.
plugin_name - String! The goaltype plugin used to implement this goal.
start_date - core_date The date the goal will commence.
Arguments
format - core_date_format
target_type - String The type of the target for the goal, e.g. date, percentage, currency, number, manual.
target_date - core_date The date the goal is expected to be completed/closed.
Arguments
format - core_date_format
target_value - Float The expected value for achieving the goal.
current_value - Float The value towards the goal currently achieved so far.
current_value_updated_at - core_date The date the current_value was most recently updated.
Arguments
format - core_date_format
status - perform_goal_status The current status of the goal.
status_updated_at - core_date The date the status was most recently updated.
Arguments
format - core_date_format
closed_at - core_date The date the goal was closed, or null if the goal is still active.
Arguments
format - core_date_format
created_at - core_date The date the goal record was first created.
Arguments
format - core_date_format
updated_at - core_date The date the goal record was last updated.
Arguments
format - core_date_format
comment_count - Int! The number of comments for the goal.
goal_tasks_metadata - perform_goal_goal_tasks_metadata! Tasks meta information for this goal.
Example
{
  "id": 123456,
  "context_id": 4,
  "category_id": 1,
  "owner": {"id": 5, "username": "system_manager_user1"},
  "user": {"id": 3, "username": "jane_smith"},
  "name": "Show understanding of Sales methods",
  "id_number": "sf_4067",
  "description": "The learner must show knowledge of 5 sales methods.",
  "assignment_type": "abc123",
  "plugin_name": "xyz789",
  "start_date": "26/07/2023",
  "target_type": "date",
  "target_date": "26/08/2023",
  "target_value": 100,
  "current_value": 25,
  "current_value_updated_at": "3/07/2023",
  "status": {"id": "not_started", "label": "Not started"},
  "status_updated_at": "26/08/2023",
  "closed_at": "26/08/2023",
  "created_at": "26/07/2023",
  "updated_at": "26/08/2023",
  "comment_count": 123,
  "goal_tasks_metadata": perform_goal_goal_tasks_metadata
}

perform_goal_goal_raw_data

Description

Goal metadata from a goal create/retrieve/update/delete operation.

Fields
Field Name Description
available_statuses - [perform_goal_status!]! Allowed goal status values.
description - String Associated goal description.
Arguments
format - core_format
Example
{
  "available_statuses": [perform_goal_status],
  "description": "xyz789"
}

perform_goal_goal_task

Description

Represents a goal task value.

Fields
Field Name Description
id - core_id! Internal database ID of the task.
goal_id - core_id! Internal database ID of the parent goal.
description - String Task description.
Arguments
format - core_format
completed_at - core_date The date the task was completed.
Arguments
format - core_date_format
created_at - core_date! The date the task was first created.
Arguments
format - core_date_format
updated_at - core_date The date the task was last updated.
Arguments
format - core_date_format
resource_exists - Boolean Indicates whether the associated resource (e.g. course) exists. If this is false and resource_id is not null, it means the resource originally existed but has now been deleted.
resource_can_view - Boolean! Indicates whether the resource is viewable by the current user.
resource - perform_goal_goal_task_resource Associated resource if any.
Example
{
  "id": 123456,
  "goal_id": 123456,
  "description": "I have to study \"Information security\" course",
  "completed_at": "26/07/2023",
  "created_at": "26/07/2023",
  "updated_at": "26/08/2023",
  "resource_exists": true,
  "resource_can_view": true,
  "resource": perform_goal_goal_task_resource
}

perform_goal_goal_task_resource

Description

Represents a goal task resource.

Fields
Field Name Description
id - core_id! Internal database ID of the resource.
task_id - core_id! Internal database ID of the parent task.
resource_id - core_id! Points to the id in the table of the given resource type.
resource_type - Int! Numerical code for the resource type.
created_at - core_date! The date the resource was first created.
Arguments
format - core_date_format
resource_custom_data - String Extra data about the goal_task resource, e.g. a course resource.
Example
{
  "id": 4,
  "task_id": 4,
  "resource_id": 4,
  "resource_type": 987,
  "created_at": "2022-04-17",
  "resource_custom_data": "abc123"
}

perform_goal_goal_tasks_metadata

Description

Tasks meta information for a goal.

Fields
Field Name Description
total_count - Int! Total number of tasks for a goal.
completed_count - Int! Number of completed tasks for a goal.
Example
{"total_count": 987, "completed_count": 987}

perform_goal_operation_error

Description

Describes an error that occurred when doing a goal related query/mutation.

Fields
Field Name Description
code - String An error code representing this particular class of error.
message - String Human readable string describing the error.
Example
{
  "code": "xyz789",
  "message": "abc123"
}

perform_goal_permissions

Description

Permissions for the current user to manipulate goals.

Fields
Field Name Description
can_manage - Boolean! Whether the current user can create/update/delete goals.
can_update_status - Boolean! Whether the current user can update a goal's status.
Example
{"can_manage": true, "can_update_status": true}

perform_goal_reference

Description

Input for identifying a goal.

The goal must be specified by providing one of the following:

  • The goal's internal database id
  • The user's id_number

A goal reference must uniquely identify a single goal to be valid.

Fields
Input Field Description
id - core_id

The database ID of the goal.

id_number - String

An external identifier for the goal.

Example
{"id": 4, "id_number": "xyz789"}

perform_goal_status

Description

Represents a goal status value.

Fields
Field Name Description
id - String Status code.
label - String Status display label.
Example
{"id": "not_started", "label": "Not started"}

perform_goal_task_create_input

Description

Input provided when creating a goal task. Some fields are required.

Fields
Input Field Description
goal_id - core_id!

Internal database ID of the parent goal.

description - param_text

Goal task description.

resource_id - core_id

Points to the id in the table of the given resource type.

resource_type - Int

Numerical code for the resource type corresponding to constants in the back end code.

Example
{
  "goal_id": 4,
  "description": "I have to study \"Information security\" course",
  "resource_id": 4123,
  "resource_type": 1
}

perform_goal_task_delete_result

Description

The result returned from a goal task delete operation.

Fields
Field Name Description
success - Boolean! Whether the current goal task successfully deleted.
Example
{"success": true}

perform_goal_task_operation_error

Description

Describes an error that occurred when doing a goal task related query/mutation.

Fields
Field Name Description
code - String An error code representing this particular class of error.
message - String Human readable string describing the error.
Example
{
  "code": "abc123",
  "message": "xyz789"
}

perform_goal_task_reference

Description

Input for identifying a goal task.

The task must be specified by providing one of these:

  • The task's internal database id (if present, always ignores the position value and goal id below).

  • Its position in a parent goal's list. Note this value ranges from 0 (earliest created task) to <list size - 1> (latest created task).

Fields
Input Field Description
goal_id - core_id

The database ID of the parent goal.

id - core_id

The database ID of the task.

ordinal - Int

The task's position in the parent goal's list.

Example
{"goal_id": 4, "id": 4, "ordinal": 987}

perform_goal_task_set_progress_input

Description

Input provided when setting a goal task's progress.

Fields
Input Field Description
goal_task_reference - perform_goal_task_reference!

Input value(s) for identifying a goal task.

completed - Int!

The task completion status: 0 = false, anything else = true.

Example
{
  "goal_task_reference": perform_goal_task_reference,
  "completed": 1
}

perform_goal_task_update_input

Description

Input provided when updating a goal task.

Fields
Input Field Description
goal_task_reference - perform_goal_task_reference!

Input value(s) for identifying a goal task.

description - param_text

Goal task description.

resource_id - core_id

Points to the id in the table of the given resource type.

resource_type - Int

Numerical code for the resource type corresponding to constants in the back end code.

Example
{
  "goal_task_reference": perform_goal_task_reference,
  "description": "This is a string",
  "resource_id": 4,
  "resource_type": 123
}

perform_goal_task_upsert_result

Description

The result returned from a goal task create/update/set progress operation.

Fields
Field Name Description
goal_task - perform_goal_goal_task Task type object, containing information about a goal task.
success - Boolean! Indicates if the operation succeeded.
errors - perform_goal_task_operation_error Error messages if the operation failed.
Example
{
  "goal_task": perform_goal_goal_task,
  "success": true,
  "errors": perform_goal_task_operation_error
}

perform_goal_update_input

Description

Input provided when updating a goal. No field is required.

Fields
Input Field Description
name - String

The display name for the goal.

id_number - String

An external identifier for the goal.

description - String

Comments or a statement about the goal.

start_date - core_date

The date the goal will commence.

target_type - String

The type of the target for the goal, e.g. date, percentage, currency, number, manual.

target_date - core_date

The date the goal is expected to be completed/closed.

target_value - Float

The expected value for achieving the goal.

Example
{
  "name": "Display knowledge of 5 sales methods",
  "id_number": "sf_10133",
  "description": "The learner must show knowledge of 5 sales methods.",
  "start_date": 1696289455,
  "target_type": "date",
  "target_date": 1701513055,
  "target_value": 100
}

perform_goal_update_progress_input

Description

Values to update a goal's progress with.

Fields
Input Field Description
current_value - Float!

The value towards the goal currently achieved so far.

status - String!

The current status of the goal.

Example
{"current_value": 25, "status": "in_progress"}

perform_goal_update_progress_result

Description

Values returned from a perform_goal_update_progress operation.

Fields
Field Name Description
current_value - Float The value towards the goal currently achieved so far.
status - perform_goal_status! The current status of the goal.
Example
{"current_value": 987.65, "status": perform_goal_status}

perform_goal_user_goals_filter

Description

Filters input provided when querying available goals for a user.

Fields
Input Field Description
user - core_user_user_reference

The user whose goals will be fetched. If left out, defaults to the logged-in user.

search - param_text

A search term for searching the goals

status - [param_alphaext!]

A list of status codes to filter for. The status codes correspond to the status class names.

Example
{
  "user": core_user_user_reference,
  "search": "This is a string",
  "status": ["Ab_cd-e"]
}

perform_goal_user_goals_input

Description

Input provided when querying available goals for a user.

Fields
Input Field Description
filters - perform_goal_user_goals_filter

Filters when querying available goals for a user.

options - perform_goal_user_goals_options

Options (e.g. sorting) when querying available goals for a user.

pagination - core_pagination_input

Standard pagination input.

Example
{
  "filters": perform_goal_user_goals_filter,
  "options": perform_goal_user_goals_options,
  "pagination": core_pagination_input
}

perform_goal_user_goals_options

Description

Options input provided when querying available goals for a user.

Fields
Input Field Description
sort_by - param_alphaext

Sort by a given field. Possible values are created_at, target_date, most_complete, least_complete.

Example
{"sort_by": "Ab_cd-e"}

perform_goal_user_goals_result

Description

The result returned from a query to find the available goals for a user.

Fields
Field Name Description
items - [perform_goal_user_goals_result_item] Retrieved personal goals.
total - Int! Total number of personal goals retrieved across all pages.
next_cursor - String! Pointer to next page of personal goals.
has_goals - Boolean! Flag indicating if the user has at least one goal (independent of filter input).
success - Boolean! Indicates if the operation succeeded.
errors - perform_goal_operation_error Error messages if the operation failed.
Example
{
  "items": [perform_goal_user_goals_result_item],
  "total": 123,
  "next_cursor": "abc123",
  "has_goals": true,
  "success": true,
  "errors": perform_goal_operation_error
}

perform_goal_user_goals_result_item

Description

Information on one goal.

Fields
Field Name Description
goal - perform_goal_goal! Retrieved goal.
permissions - perform_goal_permissions! Permissions for the goal with respect to the currently logged-in user.
Example
{
  "goal": perform_goal_goal,
  "permissions": perform_goal_permissions
}

perform_goal_view_result

Description

The result returned from a goal view operation.

Fields
Field Name Description
goal - perform_goal_goal Goal type object, containing information about a personal or team goal.
raw - perform_goal_goal_raw_data Goal metadata from a goal retrieve operation.
permissions - perform_goal_permissions Permissions for the current user to manipulate goals.
Example
{
  "goal": perform_goal_goal,
  "raw": perform_goal_goal_raw_data,
  "permissions": perform_goal_permissions
}

Troubleshooting diagnostics

Queries

tool_diagnostic_get_providers

Description

Get all providers.

Response

Returns [tool_diagnostic_provider!]!

Example

Query
query tool_diagnostic_get_providers {
  tool_diagnostic_get_providers {
    id
    name
    description
    enabled
    whitelist
  }
}
Response
{
  "data": {
    "tool_diagnostic_get_providers": [
      {
        "id": "abc123",
        "name": "abc123",
        "description": "abc123",
        "enabled": true,
        "whitelist": "abc123"
      }
    ]
  }
}

Mutations

tool_diagnostic_run_diagnostics

Description

Run providers and return location to file created.

Arguments
Name Description
excluded_provider_ids - [param_alphanumext!]

Example

Query
mutation tool_diagnostic_run_diagnostics($excluded_provider_ids: [param_alphanumext!]) {
  tool_diagnostic_run_diagnostics(excluded_provider_ids: $excluded_provider_ids) {
    download_url
    download_filesize
  }
}
Variables
{"excluded_provider_ids": ["Abc_123-0"]}
Response
{
  "data": {
    "tool_diagnostic_run_diagnostics": {
      "download_url": "xyz789",
      "download_filesize": 987
    }
  }
}

Types

tool_diagnostic_provider

Description

Information about a provider.

Fields
Field Name Description
id - String!
name - String!
description - String!
enabled - Boolean!
whitelist - String!
Example
{
  "id": "xyz789",
  "name": "abc123",
  "description": "abc123",
  "enabled": true,
  "whitelist": "abc123"
}

tool_diagnostic_run_diagnostics_result

Description

Result about running the diagnostics

Fields
Field Name Description
download_url - String!
download_filesize - Int!
Example
{
  "download_url": "abc123",
  "download_filesize": 987
}

User

Queries

core_user_user

Description

Return a specific user in the system.

Response

Returns a core_user_user_result!

Arguments
Name Description
reference - core_user_user_reference! Input object specifying data for the existing user.

Example

Query
query core_user_user($reference: core_user_user_reference!) {
  core_user_user(reference: $reference) {
    user {
      ...core_userFragment
    }
  }
}
Variables
{"reference": core_user_user_reference}
Response
{
  "data": {
    "core_user_user": {
      "user": {
        "id": 4,
        "username": "jsmith",
        "email": "jsmith@example.com",
        "firstname": "John",
        "lastname": "Smith",
        "custom_fields": [
          {"shortname": "employeeid", "data": "EM12345", "data_type": "TEXT"}
        ]
      }
    }
  }
}

core_user_users

Description

Return a paginated list of users in the system. Deleted users are excluded and multitenancy restrictions apply. By default, only active (non-suspended) users are included.

Response

Returns a core_user_users_result!

Arguments
Name Description
query - core_user_users_query Sort and pagination information to control the data returned.

Example

Query
query core_user_users($query: core_user_users_query) {
  core_user_users(query: $query) {
    items {
      ...core_userFragment
    }
    total
    next_cursor
  }
}
Variables
{"query": core_user_users_query}
Response
{
  "data": {
    "core_user_users": {
      "items": [
        {
          "username": "test",
          "firstname": "Test",
          "lastname": "User",
          "email": "testuser@example.com"
        },
        {
          "username": "another",
          "firstname": "Another",
          "lastname": "User",
          "email": "anotheruser@example.com"
        }
      ],
      "total": 47,
      "next_cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319"
    }
  }
}

Mutations

core_user_create_user

Description

Create a new user.

Response

Returns a core_user_user_result!

Arguments
Name Description
input - core_user_create_user_input! Input object specifying data for the new user.

Example

Query
mutation core_user_create_user($input: core_user_create_user_input!) {
  core_user_create_user(input: $input) {
    user {
      ...core_userFragment
    }
  }
}
Variables
{"input": core_user_create_user_input}
Response
{
  "data": {
    "core_user_create_user": {
      "user": {
        "id": 4,
        "username": "jsmith",
        "email": "jsmith@example.com",
        "firstname": "John",
        "lastname": "Smith",
        "custom_fields": [
          {"shortname": "employeeid", "data": "EM12345", "data_type": "TEXT"}
        ]
      }
    }
  }
}

core_user_delete_user

Description

Delete the target user. Note: a service account making a request cannot delete its own user account.

Response

Returns a core_user_delete_user_result!

Arguments
Name Description
target_user - core_user_user_reference! Target user which is being deleted.

Example

Query
mutation core_user_delete_user($target_user: core_user_user_reference!) {
  core_user_delete_user(target_user: $target_user) {
    user_id
  }
}
Variables
{"target_user": core_user_user_reference}
Response
{"data": {"core_user_delete_user": {"user_id": 4}}}

core_user_update_user

Description

Update the specified target user with new properties. Note: a service account making a request cannot suspend its own user account.

Response

Returns a core_user_user_result!

Arguments
Name Description
target_user - core_user_user_reference! User to be updated.
input - core_user_update_user_input! Input object specifying data for updating the user.

Example

Query
mutation core_user_update_user(
  $target_user: core_user_user_reference!,
  $input: core_user_update_user_input!
) {
  core_user_update_user(
    target_user: $target_user,
    input: $input
  ) {
    user {
      ...core_userFragment
    }
  }
}
Variables
{
  "target_user": core_user_user_reference,
  "input": core_user_update_user_input
}
Response
{
  "data": {
    "core_user_update_user": {
      "user": {
        "id": 4,
        "username": "jsmith",
        "email": "jsmith@example.com",
        "firstname": "John",
        "lastname": "Smith",
        "custom_fields": [
          {"shortname": "employeeid", "data": "EM12345", "data_type": "TEXT"}
        ]
      }
    }
  }
}

Types

core_user

Description

User type object, containing information about an individual user.

Fields
Field Name Description
id - core_id! Internal database id of the user.
idnumber - String The id number of the user.
username - String Username for the user. This field is used in combination with the password for logging in with some authentication types.
Arguments
format - core_format

Output format this field should be formatted for.

fullname - String! Full name of the user. This field combines other name fields as specified by the site display settings.
Arguments
format - core_format
firstname - String First name of the user.
Arguments
format - core_format

Output format this field should be formatted for.

lastname - String Last name of the user.
Arguments
format - core_format

Output format this field should be formatted for.

middlename - String Middle name of the user.
Arguments
format - core_format

Output format this field should be formatted for.

alternatename - String Alternate name of the user.
Arguments
format - core_format

Output format this field should be formatted for.

firstnamephonetic - String Phonetic spelling of the user's first name.
lastnamephonetic - String Phonetic spelling of the user's last name.
email - String Email address of the user.
address - String The user's address.
Arguments
format - core_format

Output format this field should be formatted for.

phone1 - String Primary phone number of the user.
Arguments
format - core_format

Output format this field should be formatted for.

phone2 - String Secondary phone number of the user.
Arguments
format - core_format

Output format this field should be formatted for.

department - String Department the user belongs to.
Arguments
format - core_format

Output format this field should be formatted for.

institution - String Institution (organisation) the user belongs to.
Arguments
format - core_format

Output format this field should be formatted for.

city - String City where the user is located.
Arguments
format - core_format

Output format this field should be formatted for.

country - String Country of the user, displayed as a string, for example 'New Zealand'.
description - String Description field for the user's profile.
Arguments
format - core_format

Output format this field should be formatted for. Note: if the system setting 'profilesforenrolledusersonly' is enabled, the profile description of a user who is not yet enrolled in any course will be hidden. Description could also be hidden until a user has at least one role assignment. (This is to prevent misuse of user profile information by spammers.)

descriptionformat - core_format Format of the description field, as stored in the database.
profileurl - String Profile url can be null if the viewer cannot view the target user's profile.
profileimageurl - String URL pointing to the main version of the user's profile image.
profileimageurlsmall - String URL pointing to a small version of the user's profile image.
profileimagealt - String Alternate text description of the profile image, for accessibility purposes.
Arguments
format - core_format

Output format this field should be formatted for.

lang - String Language of the user, for example 'en_us'.
theme - String Theme setting for the user or an empty string if the user is using the site default theme.
suspended - Boolean Whether this user is marked as suspended. Suspended users are unable to log in.
timezone - String

Timezone of the user, as a string, for example 'Pacific/Auckland'.

Note that if the admin setting 'forcetimezone' is configured, its value will be used here instead.

interests - String Comma-separated string of interests the user has or null if no interests are assigned.
firstaccess - core_date Timestamp of when this user first accessed the site (or null if never).
Arguments
format - core_date_format

Date format that firstaccess should be returned in.

lastaccess - core_date Timestamp of when this user last accessed the site (or null if never).
Arguments
format - core_date_format

Date format that lastaccess should be returned in.

url - String URL for the user's profile.
Arguments
format - core_format

Output format this field should be formatted for.

skype - String Skype username for the user's profile.
Arguments
format - core_format

Output format this field should be formatted for.

custom_fields - [core_user_custom_field!] Custom fields are additional fields that can be defined by a Site Administrator to allow additional specific data to be connected to users. Hidden and restricted custom fields require 'moodle/user:viewalldetails' capability.
job_assignments - [totara_job_job_assignment!]! This user's job assignments.
Example
{
  "id": 4,
  "idnumber": "RW1234",
  "username": "rebecca.woodhouse",
  "fullname": "Rebecca Woodhouse",
  "firstname": "Rebecca",
  "lastname": "Woodhouse",
  "middlename": "Jane",
  "alternatename": "Becky",
  "firstnamephonetic": "abc123",
  "lastnamephonetic": "xyz789",
  "email": "rebecca.woodhouse@example.com",
  "address": "1 Civic Square, London, England",
  "phone1": "+64 4 555 1234",
  "phone2": "+64 21 555 1234",
  "department": "Marketing",
  "institution": "Acme Inc.",
  "city": "London",
  "country": "United Kingdom",
  "description": "I have an interest in agile project management and software development.",
  "descriptionformat": "PLAIN",
  "profileurl": "abc123",
  "profileimageurl": "https://YOUR-SITE-URL/theme/image.php/ventura/core/1661990216/u/f1",
  "profileimageurlsmall": "https://YOUR-SITE-URL/theme/image.php/ventura/core/1661990216/u/f2",
  "profileimagealt": "Picture of Rebecca Woodhouse",
  "lang": "en",
  "theme": "ventura",
  "suspended": true,
  "timezone": "Europe/London",
  "interests": "xyz789",
  "firstaccess": "2022-04-17",
  "lastaccess": "2022-04-17",
  "url": "https://www.example.com/~rwoodhouse/",
  "skype": "rebecca.woodhouse",
  "custom_fields": [
    {"shortname": "worklocation", "data": "Remote", "data_type": "TEXT"},
    {"shortname": "employeeid", "data": "456789", "data_type": "TEXT"}
  ],
  "job_assignments": [
    {
      "idnumber": "my_id1243",
      "fullname": "Sales Manager",
      "shortname": "SM1",
      "description": "This is a description",
      "userid": 1234567,
      "positionid": 543421
    }
  ]
}

core_user_create_user_input

Description

Input provided when creating a user.

Fields
Input Field Description
username - String!

Username for the user. This field is used in combination with the password for logging in with some authentication types. Username must be unique on the site.

email - param_email!

Email address of the user. Must be unique unless 'allowaccountssameemail' setting is enabled (not recommended).

password - String

Initial password for user. This will only be used with certain internal auth methods such as 'manual'. This field is required unless you set generate_password to true OR use external auth methods for your site.

firstname - String!

First name of the user.

lastname - String!

Last name of the user.

idnumber - String

The id number of the user.

firstnamephonetic - String

Optional phonetic spelling of the user's first name.

lastnamephonetic - String

Optional phonetic spelling of the user's last name.

middlename - String

Middle name of the user.

alternatename - String

Alternate name of the user.

city - String

City where the user is located. If not provided the system will use the admin setting 'defaultcity' if set.

description - String

Rich-text description field for the user's profile.

descriptionformat - core_format

Format of the description field for the user's profile. See core_format for options.

url - String

URL for the user's profile.

skype - String

Skype username for the user's profile.

institution - String

Institution (organisation) the user belongs to, for the user's profile. This is not connected to job assignment organisation.

department - String

Department the user belongs to.

phone1 - String

Primary phone number of the user.

phone2 - String

Secondary phone number of the user.

address - String

The user's address.

country - String

ISO-3166 two-letter country code of the user, e.g. 'NZ'. Country code list: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

timezone - String

Timezone of the user, as a string, for example 'Pacific/Auckland'. If not provided the value from the admin setting 'timezone' will be used instead. We recommend using location-based timezones rather than UTC+1 etc. A list of available timezones can be found at https://www.php.net/manual/en/timezones.php.

Note that if the admin setting 'forcetimezone' is configured, any value provided here will be stored but not displayed/used - the forcetimezone value will be used instead.

lang - String

Language of the user, for example 'en_us'. Valid options depend on the site's installed language packs.

theme - String

Theme setting for the user. If the Totara system setting for 'allow user themes' is enabled, then a valid theme name will be accepted from this request, e.g. 'ventura'. If the system setting is disabled, then the theme value will be ignored.

auth - String

Authentication plugin for this user, for example 'manual'. The available options will depend on which authentication plugins are installed and enabled on the site.

calendartype - String

Calendar type for this user, for example 'gregorian'. The available options will depend on which calendar plugins are installed and enabled on the site.

emailstop - Boolean

Whether this user should be completely prevented from receiving any email notifications. Default is false.

suspended - Boolean

Whether this user should be marked as suspended. Suspended users are unable to log in. Default is false.

tenant - totara_tenant_tenant_reference

A reference to a tenant that the user should be assigned to. The API client must be permitted to assign the specified tenant. If not given the user will be automatically assigned based on the API client's tenant, or to the System.

Ignored if multitenancy is disabled.

custom_fields - [core_user_custom_field_input!]

Optional array of custom profile field data (each array element describes a single custom field value for this user). Hidden and restricted custom fields require 'moodle/user:viewalldetails' capability.

force_password_change - Boolean

Prompt the user to change their password on their next login.

generate_password - Boolean

Generate a random password for the user and send it to them via email.

Example
{
  "username": "rebecca.woodhouse",
  "email": "rebecca.woodhouse@example.com",
  "password": "supersecret",
  "firstname": "Rebecca",
  "lastname": "Woodhouse",
  "idnumber": "RW1234",
  "firstnamephonetic": "reh BEH kuh",
  "lastnamephonetic": "WUUD hows",
  "middlename": "Jane",
  "alternatename": "Becky",
  "city": "London",
  "description": "I have an interest in agile project management and software development.",
  "descriptionformat": "PLAIN",
  "url": "https://www.example.com/~rwoodhouse/",
  "skype": "rebecca.woodhouse",
  "institution": "Acme Inc.",
  "department": "Marketing",
  "phone1": "+64 4 555 1234",
  "phone2": "+64 21 555 1234",
  "address": "1 Civic Square, London, England",
  "country": "GB",
  "timezone": "Europe/London",
  "lang": "en",
  "theme": "ventura",
  "auth": "manual",
  "calendartype": "gregorian",
  "emailstop": true,
  "suspended": true,
  "tenant": {"idnumber": "tenant1"},
  "custom_fields": [
    {"shortname": "worklocation", "data": "Remote", "data_type": "TEXT"},
    {"shortname": "employeeid", "data": "456789", "data_type": "TEXT"}
  ],
  "force_password_change": true,
  "generate_password": true
}

core_user_custom_field

Description

Type containing read-only custom field data. Each object of this type represents the value of the field. The format of this string will depend on the custom field type it is representing but will contain the field's stored value.

Fields
Field Name Description
shortname - String! Shortname of the custom field the data relates to.
data - String! The custom field data value for this user. Returns the value stored in the database for this user and field, without any processing (such as inserting field default when value is empty, or converting of timestamps to human-readable strings).
data_format - Int

Format of the stored value of the data field. Provided at the time the data is stored, see the core_user_custom_field_input input type for more information. Currently only used by the text area custom field type when rendering in the UI.

Options are:

  • 1: HTML
  • 2: Plain text
  • 4: Markdown
  • 5: JSON
data_type - String! Indicating data type of user profile custom field.
Example
{
  "shortname": "employeeid",
  "data": "EM12345",
  "data_format": 1,
  "data_type": "TEXT"
}

core_user_custom_field_input

Description

Input type representing a single custom field for a particular user.

Fields
Input Field Description
shortname - String!

Shortname is used to uniquely identify the custom field the data is for. It must exactly match the shortname of a custom field that exists on the site or an error will be thrown. Note if the same shortname is provided multiple times in a request (not recommended) they will be applied in order so the last one will be used.

data - String

Represents the value for the custom field for this user. This field is required unless the delete flag is set. The format of this data will depend on the field type of the field specified by shortname:

  • checkbox: string of 0 (unchecked) or 1 (checked).
  • menu: A string exactly matching one of the menu options (case sensitive).
  • text: A string of plain-text.
  • textarea: A string of formatted text, in the format specified via the data_format field (see below).
  • datetime: A string in the format YYYY-MM-DD or YYYY-MM-DD-HH-MM-SS (depending on if the field uses the 'Include time?' option). If the field defines a year range, the input will be validated to ensure it falls within that range. If only YYYY-MM-DD is provided for a field where 'Include time?' is enabled, midnight will be used for the time. Stored as a unix timestamp using the timezone of the client's service account.
  • date: A string in the format YYYY-MM-DD. Stored as a timestamp so uses noon UTC for time to ensure date displayed is consistent across most timezones.
data_format - Int

Optional property, which must be provided textarea field types but should not be passed for other types. Used to record the format of the 'data' field so it can be correctly rendered. Options are:

  • 1: HTML
  • 2: Plain-text
  • 4: Markdown
  • 5: JSON
delete - Boolean

Flag indicating that the data for this custom field should be deleted. This flag should only be set if not passing new or updated data for the field.

Example
{"shortname": "employeeid", "data": "EM12345", "data_format": 1, "delete": true}

core_user_delete_user_result

Description

Mutation result type returned after deletion of a user.

Returns the id of deleted user if it was deleted successfully.

Fields
Field Name Description
user_id - core_id! Internal database id of the user that was just deleted from the system.
Example
{"user_id": 4}

core_user_enrolment

Description

Represents user enrolment data.

Fields
Field Name Description
id - core_id! The unique identifier for the user enrolment.
enrolment - core_enrol! The enrolment instance.
status - core_user_enrolment_status_enum! The status of the user enrolment.
timestart - core_date! The start date for the enrolment (in the specified format, defaulting to TIMESTAMP).
Arguments
format - core_date_format
timeend - core_date The end date for the enrolment (in the specified format, defaulting to TIMESTAMP).
Arguments
format - core_date_format
timecreated - core_date! The creation time for the enrolment (in the specified format, defaulting to TIMESTAMP).
Arguments
format - core_date_format
timemodified - core_date! The modification time for the enrolment (in the specified format, defaulting to TIMESTAMP).
Arguments
format - core_date_format
modified_by - core_user! The user who last modified the enrolment.
Example
{
  "id": 9,
  "enrolment": core_enrol,
  "status": "ENROL_USER_ACTIVE",
  "timestart": "1698226645",
  "timeend": "1698226645",
  "timecreated": "1698226645",
  "timemodified": "1698226645",
  "modified_by": {"id": 7, "idnumber": "abc"}
}

core_user_enrolment_status_enum

Description

Enumerates the possible user enrolment status values.

Values
Enum Value Description

ENROL_USER_ACTIVE

The user enrolment is currently active.

ENROL_USER_SUSPENDED

The user enrolment is currently suspended.
Example
"ENROL_USER_ACTIVE"

core_user_update_user_input

Description

Input provided when updating a user.

Fields
Input Field Description
username - param_username

Username for the user. This field is used in combination with the password for logging in with some authentication types. Username must be unique on the site.

firstname - String

First name of the user.

lastname - String

Last name of the user.

email - param_email

Email address of the user. Must be unique unless 'allowaccountssameemail' admin setting is enabled.

password - String

New password for the user. This will only be used with certain auth methods such as 'manual'.

idnumber - String

The id number of the user.

firstnamephonetic - String

Optional phonetic spelling of the user's first name.

lastnamephonetic - String

Optional phonetic spelling of the user's last name.

middlename - String

Middle name of the user.

alternatename - String

Alternate name of the user.

city - String

City where the user is located. If not provided the system will use the admin setting 'defaultcity' if set.

description - String

Rich-text description field for the user's profile.

descriptionformat - core_format

Rich-text format of the description field.

url - String

URL for the user's profile.

skype - String

Skype username for the user's profile.

institution - String

Institution (organisation) the user belongs to, for the user's profile. This is not connected to job assignment organisation.

department - String

Department the user belongs to.

phone1 - String

Primary phone number of the user.

phone2 - String

Secondary phone number of the user.

address - String

The user's address.

country - String

ISO-3166 two-letter country code of the user, e.g. 'NZ'. Country code list: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

timezone - String

Timezone of the user, as a string, for example 'Pacific/Auckland'. We recommend using location-based timezones rather than UTC+1 etc. A list of available timezones can be found at https://www.php.net/manual/en/timezones.php.

Note that if the admin setting 'forcetimezone' is configured, any value provided here will be stored but not displayed/used - the forcetimezone value will be used instead.

lang - String

Language of the user, for example 'en_us'. Valid options depend on the site's installed language packs.

theme - String

Theme setting for the user. If the admin setting 'allowuserthemes' is enabled, then a valid theme name will be accepted from this request, e.g. 'ventura'. If that admin setting is disabled, then the theme value will be ignored.

auth - String

Authentication plugin for this user, for example 'manual'. The available options will depend on which authentication plugins are installed and enabled on the site.

calendartype - String

Calendar type for this user, for example 'gregorian'. The available options will depend on which calendar plugins are installed and enabled on the site.

emailstop - Boolean

Whether this user should be completely prevented from receiving any email notifications. Default is false.

suspended - Boolean

Whether this user should be marked as suspended. Suspended users are unable to log in. Default is false.

tenant - totara_tenant_tenant_reference

A reference to a tenant that the user should be assigned to. The API client must be permitted to assign the specified tenant. To change tenant the API client must have 'totara/tenant:manageparticipants' capability in system context.

custom_fields - [core_user_custom_field_input!]

Optional array of custom profile field data (each array element describes a single custom field value for this user). Hidden and restricted custom fields require 'moodle/user:viewalldetails' capability.

force_password_change - Boolean

Prompt the user to change their password on their next login.

generate_password - Boolean

Generate a random password for the user and send it to them via email.

Example
{
  "username": "rebecca.woodhouse",
  "firstname": "Rebecca",
  "lastname": "Woodhouse",
  "email": "rebecca.woodhouse@example.com",
  "password": "supersecret",
  "idnumber": "RW1234",
  "firstnamephonetic": "reh BEH kuh",
  "lastnamephonetic": "WUUD hows",
  "middlename": "Jane",
  "alternatename": "Becky",
  "city": "London",
  "description": "I have an interest in agile project management and software development.",
  "descriptionformat": "PLAIN",
  "url": "https://www.example.com/~rwoodhouse/",
  "skype": "rebecca.woodhouse",
  "institution": "Acme Inc.",
  "department": "Marketing",
  "phone1": "+64 4 555 1234",
  "phone2": "+64 21 555 1234",
  "address": "1 Civic Square, London, England",
  "country": "GB",
  "timezone": "Europe/London",
  "lang": "en",
  "theme": "ventura",
  "auth": "manual",
  "calendartype": "gregorian",
  "emailstop": true,
  "suspended": true,
  "tenant": {"idnumber": "tenant1"},
  "custom_fields": [
    {"shortname": "worklocation", "data": "Remote", "data_type": "TEXT"},
    {"shortname": "employeeid", "data": "456789", "data_type": "TEXT"}
  ],
  "force_password_change": true,
  "generate_password": true
}

core_user_user_reference

Description

Input for identifying a user.

The user must be specified by providing one of the following:

  • The user's internal database id
  • The user's idnumber
  • The user's username
  • The user's email address

A user reference must uniquely identify a single user to be valid. Deleted users are excluded, as are users not accessible due to multitenancy restrictions.

Fields
Input Field Description
id - core_id

Internal database id of the user.

username - String

Username of the user.

idnumber - String

The id number of the user.

email - String

Email address of the user.

Example
{
  "id": 5,
  "username": "target.user",
  "idnumber": "EM12345",
  "email": "target.user@example.com"
}

core_user_user_result

Description

User result type returned after the creation of a new user, updates to an existing user, or from selecting an existing user. Returns the user information.

Fields
Field Name Description
user - core_user! User object for the user that was created or updated as part of the operation.
Example
{
  "user": {
    "id": 4,
    "username": "jsmith",
    "email": "jsmith@example.com",
    "firstname": "John",
    "lastname": "Smith",
    "custom_fields": [
      {"shortname": "employeeid", "data": "EM12345", "data_type": "TEXT"}
    ]
  }
}

core_user_user_status

Description

Enum for user status filter.

Option ALL indicates all statuses.

Values
Enum Value Description

ALL

ACTIVE

SUSPENDED

Example
"ALL"

core_user_users_filters

Description

Input type used when querying for a list of users. Specifies filters to be applied to the results.

Fields
Input Field Description
status - core_user_user_status

The status of a user. By default, only ACTIVE users are returned. Deleted users are never returned.

since_timecreated - core_date

Unix creation timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

since_timemodified - core_date

Unix timemodification timestamp of tag including an integer timestamp, numeric string or an ISO-8601 string.

Example
{
  "status": "SUSPENDED",
  "since_timecreated": "1696837540",
  "since_timemodified": "1696837540"
}

core_user_users_query

Description

Input type used when querying for a list of users. Specifies pagination and sorting information that can impact the structure of the results.

Fields
Input Field Description
pagination - core_pagination_input

Pagination information such as which page to return and the number of results requested.

sort - [core_sort_input!]

The sort order of the query. Allowed entity fields for the sort column are 'id', 'firstname', 'lastname', 'username' and 'timemodified'.

filters - core_user_users_filters

The filters for querying users.

Example
{
  "pagination": {
    "cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319",
    "limit": 20
  },
  "sort": [{"column": "timemodified", "direction": "ASC"}],
  "filters": core_user_users_filters
}

core_user_users_result

Description

Result returned from the core_user_users query. Contains a page of results along with pagination information.

Fields
Field Name Description
items - [core_user!]! Array of one page of users returned by the query.
total - Int! Total number of users from this query (across all pages).
next_cursor - String! Cursor to request the next set of results for this query.
Example
{
  "items": [
    {
      "username": "test",
      "firstname": "Test",
      "lastname": "User",
      "email": "testuser@example.com"
    },
    {
      "username": "another",
      "firstname": "Another",
      "lastname": "User",
      "email": "anotheruser@example.com"
    }
  ],
  "total": 47,
  "next_cursor": "eyJsaW1pdCI6MSwiY29sdW1ucyI6eyJpZCI6M319"
}

Web API

Queries

totara_webapi_status

Description

Simple query returning "ok" to test that you are able to successfully execute GraphQL queries.

Response

Returns a totara_webapi_status

Example

Query
query totara_webapi_status {
  totara_webapi_status {
    status
    timestamp
  }
}
Response
{
  "data": {
    "totara_webapi_status": {
      "status": "ok",
      "timestamp": "2022-04-17"
    }
  }
}

Types

totara_webapi_status

Description

Type containing information about the current status of the API. status is always 'ok'. This is intended to test that you are able to successfully execute GraphQL queries.

Fields
Field Name Description
status - String! The status of the API (always returns 'ok' if working).
timestamp - core_date Timestamp of the request.
Arguments
format - core_date_format

Format of the timestamp in the response.

Example
{"status": "ok", "timestamp": "2022-04-17"}