Schoology Adapter Actions
  • 03 Jun 2022
  • 4 Minutes to read
  • Dark
    Light

Schoology Adapter Actions

  • Dark
    Light

Article Summary

Schoology Adapter Actions

defineSchoologyConnection

Define a connection to Schoology server.

Property

Value

Description

consumerKey*

text, expression, variable

the consumer key

secretKey*

password, string, expression, variable

the secret key

options

expression, variable

A record or JavaScript object with a field for each additional option. Currently defined fields are connectTimeout and socketTime which require a numeric value from 1 to 2147483647 (0x7FFFFFFF) that represents the number of milliseconds for the timeout, and 0 representing no timeout.

returnVariable

expression, variable

name of the variable to be assigned to the return value

connection = defineSchoologyConnection("myConsumerKey",<myPassword>)

deleteSchoologyUser

Delete/Deactivate the specified Schoology User.

Property

Value

Description

connection*

expression, variable

the Schoology connection

id*

text, expression, variable

the user Schoology ID

reason

text, expression, variable

comment on reason for deactiving

keepEnrollments

boolean, expression, variable

keep history of user's grad and attendance data

emailNotification

boolean, expression, variable

send email notification to user that the account was deactived.

returnVariable

expression, variable

name of the variable to be assigned to the return value

deletedUser = deleteSchoologyUser(connection, "1234")

getSchoologyInactiveUser

Gets a specified inactive Schoology User record.

Property

Value

Description

connection*

expression, variable

the Schoology connection definition

id*

text, expression, variable

the user Schoology ID

returnVariable

expression, variable

name of the variable to be assigned to the return value

inactive = getInactiveSchoologyUsers(connection)

getSchoologyInactiveUsers

Gets inactive Schoology User records.

Property

Value

Description

connection*

expression, variable

the Schoology connection

returnVariable

expression, variable

name of the variable to be assigned to the return value

inactive = getInactiveSchoologyUsers(connection)

getSchoologyUser

Get the specified Schoology User record.

Property

Value

Description

connection*

expression, variable

the Schoology connection

id*

text, expression, variable

the Schoology id of the User

returnVariable

expression, variable

name of the variable to be assigned to the return value

user = getSchoologyUser(connection, "1234")

getSchoologyUsers

Gets Schoology User records.

Property

Value

Description

connection*

expression, variable

the Schoology connection

filterRecord

expression, variable

a record containing filter parameters

returnVariable

expression, variable

name of the variable to be assigned to the return value

Filters can be defined by creating a record object and populating the record with the fields and values to filter by. The following are the fields that can be used as filters.

Field

Value

Description

building_id

text, variable

Only return users for the given building.

role_ids

text, variable

(Comma-separated list of IDs) Only return users who belong to the given role IDs

parent_access_codes

boolean, variable

Add in parent access codes for each of the returned users (set to 1)

school_uids

text, variable

A comma-separated list of school_uids within the school (up to 50 at one time)

#define the connection
connection = defineSchoologyConnection("myConsumerKey",<Password>)
# create record filter
{
fr = createRecord(false)
addRecordFieldValue(fr, "role_id", "Student")
}
list = getSchoologyUsers(connection, fr)

openSchoologyInactiveUserIterator

Open Schoology inactive User Iterator.

Property

Value

Description

connection*

expression, variable

the Schoology connection

returnVariable

expression, variable

name of the variable to be assigned to the return value

#define the connection
connection = defineSchoologyConnection("myConsumerKey",<Password>)
inactiveUser = openSchoologyInactiveUserIterator(connection)
forEach(inactiveUser, inactiveUser) {
...
}

openSchoologyUserIterator

Get Schoology User records.

Property

Value

Description

connection*

expression, variable

the Schoology connection

filterRecord

expression, variable

a record containing filter parameters

returnVariable

expression, variable

name of the variable to be assigned to the return value

#define the connection
connection = defineSchoologyConnection("myConsumerKey",<Password>)
# create record filter
{
fr = createRecord(false)\n addRecordFieldValue(fr, "role_id", "Student")
}
users = openSchoologyUserIterator(connection, fr)
forEach(user, users) {
...
}

reactivateSchoologyUsers

Reactivates a specified list of Schoology Users.

Property

Value

Description

connection*

expression, variable

the Schoology connection

ids*

expression, variable

an array of Schoology ids to be reactivated

reenroll*

boolean, expression, variable

Set to true in the request body to place the user back into their courses and groups.

returnVariable

expression, variable

name of the variable to be assigned to the return value

reactivateSchoologyUsers(connection,"1234",true)

saveSchoologyUser

Create/Update an Schoology User record. Note you cannot update inactive users.

Property

Value

Description

connection*

expression, variable

the Schoology connection

record*

expression, variable

the Schoology User record

returnVariable

expression, variable

name of the variable to be assigned to the return value

Field

Value

Description

school_uid

text, expression, variable

The user's unique ID (e.g. student ID, SIS ID)

name_first

text, expression, variable

The user's first name

name_last

text, expression, variable

The user's last name

role_id

text, expression, variable

The ID of the role to which you would like to assign the user

username

text, expression, variable

The user's username (either a username or email address is required for each user)

primary_email

text, expression, variable

The user's primary email address (either a username or email address is required for each user)

Additional, optional fields are listed in the user api.

connection = defineSchoologyConnection("myConsumerKey",<Password>)
# create the new user record
addTest = createRecord(false)
setRecordFieldValue(addTest, "school_uid", "testUser1234")
setRecordFieldValue(addTest, "name_first", "MrTest")
setRecordFieldValue(addTest, "name_last", "Tester")
setRecordFieldValue(addTest, "role_id", "296904")
setRecordFieldValue(addTest, "additional_buildings", "456")
setRecordFieldValue(addTest, "username", "TestMaster2")
# attempt the add
newUser = saveSchoologyUser(connection, addTest)
log(newUser)

saveSchoologyUsers

Creates multiple Schoology User records.

Property

Value

Description

connection*

expression, variable

the Schoology connection

records*

expression, variable

the array of records to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

# create users
(true) {
# user 1 {

user1 = createRecord(false)
setRecordFieldValue(user1, "school_uid", "u1")
setRecordFieldValue(user1, "name_first", "Sara")
setRecordFieldValue(user1, "name_last", "Doe")
setRecordFieldValue(user1, "role_id", "296904")
setRecordFieldValue(user1, "additional_buildings", "456")
setRecordFieldValue(user1, "username", "user1")
}
# user 2 {

user2 = createRecord(false)
setRecordFieldValue(user2, "school_uid", "u2")
setRecordFieldValue(user2, "name_first", "Ryan")
setRecordFieldValue(user2, "name_last", "Jordan")
setRecordFieldValue(user2, "role_id", "296904")
setRecordFieldValue(user2, "additional_buildings", "456")
setRecordFieldValue(user2, "username", "jryan")
}
# user 3 {

user3 = createRecord(false)
setRecordFieldValue(user3, "school_uid", "u3")
setRecordFieldValue(user3, "name_first", "Austin")
setRecordFieldValue(user3, "name_last", "Powell")
# role ids can also be set using their title rather
than their id value
setRecordFieldValue(user3, "role_id", "Student")
setRecordFieldValue(user3, "additional_buildings", "456")
setRecordFieldValue(user3, "username", "paustin")
}
# create array of user records {

users = createArray()
appendArrayItem(users, user1) appendArrayItem(users, user2)
appendArrayItem(users, user3)
}
}
# connection
connection = defineSchoologyConnection("myConsumerKey", < Password > )
ret = saveSchoologyUsers(connection, users)

Full Example

connection = defineSchoologyConnection("myConsumerKey", < Password > )
# create the new user record {
addTest = createRecord(false)
setRecordFieldValue(addTest, "school_uid", "testUser12345")
setRecordFieldValue(addTest, "name_first", "MrTest")
setRecordFieldValue(addTest, "name_last", "Tester")
setRecordFieldValue(addTest, "role_id", "296904")
setRecordFieldValue(addTest, "additional_buildings", "456")
setRecordFieldValue(addTest, "username", "TestMaster3")
}
# attempt the add
newUser = saveSchoologyUser(connection, addTest)
uid = getRecordFieldValue(newUser, "uid")
log(newUser)# get the user
user = getSchoologyUser(connection, uid)
log(user)# delete the user\ nret = deleteSchoologyUser(connection, uid)
log(ret)# reactivate the user
reactivateList = createArray()
appendArrayItem(reactivateList, uid)
user = reactivateSchoologyUsers(connection, reactivateList, false)
log(user)

Was this article helpful?