Events
Events represent scheduled training events in the system.
Search
The following example fetches the first page of events starting on or after 1st May 2023 at 00:00 UTC, sorted by code and start time (ascending):
Example
query {
events(
filters:[
{field: timeZonedStart, operation: ge, value: "2023-05-01T00:00:00Z"}
]
orderBy: [
{field: code, direction: asc}
{field: timeZonedStart, direction: asc}
]
) {
edges{
node{
id
code
title
learningMode
start
end
}
}
}
}
For the full range of available filters see the EventField API Reference.
Create
The following example creates a new LMS event for the specified course templates, location, tax type, start and end times:
Example
mutation {
event{
createLMS(input:{
courseTemplateId:"Q291cnNlVGVtcGxhdGU6MTE="
eventType: public
timeZonedLmsStart: "2023-01-05T09:00:00-05:00"
timeZonedLmsEnd: "2023-01-05T18:00:00-05:00"
timeZoneName: "America/New_York"
locationId: "TG9jYXRpb246NzY="
taxTypeId:"VGF4VHlwZTox"
}) {
event{
id
lifecycleState
timeZonedStart
timeZonedEnd
}
errors{
label
message
value
}
}
}
}
The response shows the new event's lifecycleState
is draft
:
{
"data": {
"event": {
"createLMS": {
"event": {
"id": "Q291cnNlOjE=",
"lifecycleState": "draft",
"timeZonedStart": "2023-01-05T14:00:00Z",
"timeZonedEnd": "2023-01-05T23:00:00Z"
},
"errors": []
}
}
}
}
Update
For the full range of available update parameters see the EventUpdateInput API Reference.
Publish
To publish an Event, update its lifecycleState
field:
Example
mutation{
event{
update(
eventId: "Q291cnNlOjE="
input:{
lifecycleState: published
}
) {
event{
id
lifecycleState
}
errors{
label
message
value
}
}
}
}
Cancel
Similarly, to cancel an event update it to cancelled
:
Example
mutation{
event{
update(
eventId: "Q291cnNlOjE="
input:{
lifecycleState: cancelled
}
) {
event{
id
lifecycleState
}
errors{
label
message
value
}
}
}
}
Learners
Registration
Learners can be added to a published event by associating them with a Contact in your TMS:
Example
mutation {
event{
registerContacts(
eventId:"Q291cnNlOjE="
input:{
contacts:[
"UGVyc29uOjM1",
"UGVyc29uOjM="
]
}
) {
event{
id
learners(orderBy:[{field: id, direction: desc}]){
edges{
node{
id
contact{
id
personalName{
name
}
}
}
}
}
}
}
}
}
The response from the above example will show the most recent learners (ordered by descending ID) and their requested details:
{
"data": {
"event": {
"registerContacts": {
"event": {
"id": "Q291cnNlOjE=",
"learners": {
"edges": [
{
"node": {
"id": "bGVhcm5lcjoy",
"contact": {
"id": "UGVyc29uOjM=",
"personalName": {
"name": "Jane Smith"
}
}
}
},
{
"node": {
"id": "bGVhcm5lcjox",
"contact": {
"id": "UGVyc29uOjM1",
"personalName": {
"name": "Mary Green"
}
}
}
}
]
}
}
}
}
}
}
For the full range of named learner registration options (including price specifications) see the EventRegisterContacts API Reference.
Progress
Learner progress on an Event is handled by our LMS API
Events can be set up to automatically mark a Learner as "passed" on completion of all relevant content. Moreover, automatic achievement awarding can be configured. For more information, see our Support Documentation
You can manually record completion of an Event with the following:
Example
mutation {
learner{
recordResult(
learnerId: "bGVhcm5lcjoy"
hasPassed: true
) {
learner{
id
hasPassed
}
errors{
label
message
value
}
}
}
}
You can also optionally override any achievements you wish to award or prevent:
Example
mutation {
learner{
recordResultWithAchievements(
input:{
learnerId: "bGVhcm5lcjoy"
hasPassed: true
manualAchievements:[
{
achievementTypeId: "QWNoaWV2ZW1lbnRUeXBlOjE="
achieved: true
}
]
}
) {
learner{
id
hasPassed
}
errors{
label
message
value
}
}
}
}