Totara 18.0 API reference 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.

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": "xyz789"
    }
  }
}

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
123.45

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": "xyz789",
  "idnumber": "abc123",
  "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": "xyz789"
}

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.
Example
{
  "id": 4,
  "idnumber": "abc123",
  "fullname": "xyz789",
  "shortname": "abc123",
  "summary": "xyz789",
  "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": "xyz789",
  "coursetype": 987,
  "icon": "xyz789",
  "image": "abc123",
  "sections": [core_course_section],
  "modcount": 123,
  "showgrades": true,
  "completionenabled": true,
  "completion": core_course_completion,
  "criteria": [core_course_criteria],
  "criteriaaggregation": "abc123",
  "url": "abc123",
  "course_format": core_course_format,
  "tags": [core_tag]
}

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": 987.65,
  "timecompleted": "2022-04-17",
  "gradefinal": 987.65,
  "grademax": 987.65,
  "gradepercentage": 987.65
}

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": "xyz789",
  "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": "abc123",
  "name": "abc123",
  "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
Example
{
  "id": 4,
  "idnumber": "abc123",
  "instanceid": 4,
  "modtype": "abc123",
  "name": "xyz789",
  "viewurl": "abc123",
  "completion": "abc123",
  "completionenabled": true,
  "completionstatus": "xyz789",
  "rpl": true,
  "progress": 987,
  "available": true,
  "availablereason": ["abc123"],
  "visible": true,
  "showdescription": true,
  "description": "abc123",
  "descriptionformat": "RAW",
  "gradefinal": 987.65,
  "grademax": 987.65,
  "gradepercentage": 123.45
}

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": ["xyz789"],
  "visible": true,
  "summary": "abc123",
  "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"}

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_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"

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
  }
}

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.

Possible Types
totara_hierarchy_framework Types

totara_hierarchy_organisation_framework

totara_hierarchy_position_framework

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.
Possible Types
totara_hierarchy_item Types

totara_hierarchy_organisation

totara_hierarchy_position

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"}
}

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.
framework - totara_hierarchy_organisation_framework The organisation framework this organisation belongs to.
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.
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"}
}

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.
framework - totara_hierarchy_position_framework The position framework this position belongs to.
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.
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"}
}

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.

Possible Types
totara_hierarchy_type Types

totara_hierarchy_organisation_type

totara_hierarchy_position_type

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": "xyz789"
    }
  }
}

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": "abc123"
}

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": "xyz789"
}

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": "xyz789",
  "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": "xyz789"}

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_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": "xyz789",
  "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'.
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
}

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_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'.

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

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": 987,
  "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"}

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_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
  }
}
Variables
{"input": perform_goal_user_goals_input}
Response
{
  "data": {
    "perform_goal_user_goals": {
      "items": [perform_goal_user_goals_result_item],
      "total": 987,
      "next_cursor": "xyz789"
    }
  }
}

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_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_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_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": 123.45,
      "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": 987.65,
  "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_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
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"
}

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_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_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": 123.45, "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.

Example
{"user": core_user_user_reference}

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.

pagination - core_pagination_input

Standard pagination input.

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

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.
Example
{
  "items": [perform_goal_user_goals_result_item],
  "total": 123,
  "next_cursor": "xyz789"
}

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
}

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.
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": "xyz789",
  "lastnamephonetic": "abc123",
  "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",
  "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"}