Home
Softono

Schoology Api

Open source MIT Java
25
Stars
10
Forks
0
Issues
8
Watchers
2 years
Last Commit

 About Schoology Api

Java API implementation for Schoology (https://schoology.com)

Platforms

Web Self-hosted

Languages

Java

Links

Need Help Installing Schoology Api?

We provide expert installation service for this software. Our team will install, configure, and secure Schoology Api on your server. plans start at just $30.

Schoology Api

View on GitHub

schoology-api

Java implementation for the Schoology API.

Behold, a straightforward two- and three-legged authentication wrapper for the Schoology REST API.

Make sure to use the schoology-impl module for the actual OAuth (Scribe) implementation.

Setup:

Run the following commands to install the package in your local Maven repository:

$ git clone https://github.com/rvanasa/schoology-api
$ cd schoology-api/schoology-impl
$ mvn clean install

Then, paste the following snippet into your project's POM.xml dependencies:

<dependency>
    <groupId>net.rvanasa</groupId>
    <artifactId>schoology-impl</artifactId>
    <version>1.0.0</version>
</dependency>

Usage:

You can generate a user API key & secret by going to https://[DISTRICT_PREFIX].schoology.com/api

2-Legged Auth:


SchoologyRequestHandler schoology = new SchoologyRequestHandler(DISTRICT_PREFIX, API_KEY, API_SECRET);

3-Legged Auth:


SchoologyFlow flow = new SchoologyFlow(DISTRICT_PREFIX, API_KEY, API_SECRET, CALLBACK_URL);

SchoologyToken token = flow.createRequestToken();

String authUrl = token.getAuthorizationUrl();

// redirect client...

String verifier = "[Response from callback URL]";

SchoologyRequestHandler schoology = token.createRequestHandler(verifier);

Sending a Request:

Requests can be send and parsed manually, or by using the premade methods provided with the SchoologyRequestHandler.

Manually:


// [UID] represents the target user ID
SchoologyResponseBody response = schoology.get("users/[UID]?extended=true").requireSuccess().getBody();

System.out.println(response.getRawData()); // raw JSON string

SchoologyNode node = response.parse();
System.out.println(node.get("name_display").asString()); // get display name of user

schoology.put("users/[UID]", "{\"name_first_preferred\": \"NewName\"}"); // set preferred first name

Using premade methods & objects:


// [UID] represents the target user ID
SchoologyUser user = schoology.getUser("[UID]");

System.out.println(user.getNameDisplay()); // get display name of user

user.setNameFirstPreferred("NewName"); // set preferred first name

Big thanks to @electro2560 for taking this project to the next level. Contributions and feature requests are always welcome!