SDKs overview
The University of Oslo provides Software Development Kits (SDKs) and libraries to facilitate programmatic interaction with its digital infrastructure. These tools enable developers to build applications that integrate with various University services, such as student information systems, research data repositories, and administrative platforms. The SDKs abstract the underlying API complexities, offering language-specific methods and data structures for common operations.
The primary goal of these SDKs is to streamline development for internal projects, research initiatives, and external partners requiring access to University resources. They typically encapsulate RESTful API calls, handle authentication mechanisms like OAuth 2.0, and manage data serialization and deserialization. This approach reduces boilerplate code and allows developers to focus on application logic rather than low-level API communication. For a general understanding of SDK functionality, the Mozilla Developer Network's SDK definition provides context.
Official SDKs by language
The University of Oslo maintains official SDKs for widely used programming languages, ensuring direct support and compatibility with core University services. These SDKs are developed and maintained by the University's IT department or designated teams, offering stable interfaces and consistent updates. The official offerings typically include comprehensive documentation, example code, and direct support channels.
Below is a table outlining the official SDKs, their respective package names, installation commands, and typical maturity levels:
| Language | Package Name | Install Command | Maturity |
|---|---|---|---|
| Python | uio-py-sdk |
pip install uio-py-sdk |
Stable |
| JavaScript (Node.js/Browser) | @uio/js-sdk |
npm install @uio/js-sdk |
Stable |
| Java | uio-java-sdk |
Maven/Gradle dependency | Beta |
Each SDK is designed to align with the specific idioms and best practices of its target language, providing an intuitive development experience. For instance, the Python SDK might leverage standard Python data structures and error handling, while the JavaScript SDK would integrate with Promises or async/await patterns. Further details on specific API endpoints and SDK methods are available in the University of Oslo Developer Portal.
Installation
Installing the official University of Oslo SDKs typically follows standard package management procedures for each language. Developers are advised to use virtual environments (for Python) or project-specific node modules (for JavaScript) to manage dependencies effectively and avoid conflicts.
Python SDK (uio-py-sdk)
To install the Python SDK, ensure you have Python 3.8 or newer and pip (Python's package installer) configured. It is recommended to create and activate a virtual environment before installation:
python3 -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
pip install uio-py-sdk
After installation, the SDK can be imported into Python scripts. Updates can be performed using pip install --upgrade uio-py-sdk.
JavaScript SDK (@uio/js-sdk)
For the JavaScript SDK, ensure Node.js (LTS version recommended) and npm (Node Package Manager) are installed. Navigate to your project directory and execute:
npm install @uio/js-sdk
This command adds the @uio/js-sdk package to your project's node_modules directory and updates your package.json file. For browser-based applications, bundlers like Webpack or Rollup can package the SDK for client-side use. Updates are managed via npm update @uio/js-sdk.
Java SDK (uio-java-sdk)
The Java SDK is distributed via Maven Central. To include it in a Maven project, add the following dependency to your pom.xml file:
<dependency>
<groupId>no.uio.sdk</groupId>
<artifactId>uio-java-sdk</artifactId>
<version>1.0.0</version> <!-- Replace with the latest version -->
</dependency>
For Gradle projects, add the following to your build.gradle file:
implementation 'no.uio.sdk:uio-java-sdk:1.0.0' // Replace with the latest version
The latest version number can be found on the University of Oslo Java SDK documentation page.
Quickstart example
This example demonstrates how to use the Python SDK to retrieve a list of publicly available courses from the University of Oslo's course catalog API. This assumes prior authentication setup, where an API key or OAuth token is obtained according to the University's security guidelines.
Python Quickstart
from uio_py_sdk import UiOClient
# Initialize the client with your API key
# Replace 'YOUR_API_KEY' with your actual API key or token
client = UiOClient(api_key="YOUR_API_KEY")
try:
# Fetch the first 10 publicly available courses
courses = client.courses.list_public_courses(limit=10)
print("--- Public Courses ---")
for course in courses:
print(f"ID: {course.id}, Title: {course.title}, Code: {course.code}")
# Example: Fetch details for a specific course (replace with an actual course ID)
if courses:
first_course_id = courses[0].id
course_details = client.courses.get_course_details(course_id=first_course_id)
print(f"\n--- Details for Course ID {first_course_id} ---")
print(f"Description: {course_details.description[:100]}...")
except Exception as e:
print(f"An error occurred: {e}")
JavaScript Quickstart (Node.js)
This example performs a similar action using the JavaScript SDK:
const { UiOClient } = require('@uio/js-sdk');
async function getCourses() {
// Initialize the client with your API key
// Replace 'YOUR_API_KEY' with your actual API key or token
const client = new UiOClient('YOUR_API_KEY');
try {
// Fetch the first 10 publicly available courses
const courses = await client.courses.listPublicCourses({ limit: 10 });
console.log("--- Public Courses ---");
courses.forEach(course => {
console.log(`ID: ${course.id}, Title: ${course.title}, Code: ${course.code}`);
});
// Example: Fetch details for a specific course (replace with an actual course ID)
if (courses.length > 0) {
const firstCourseId = courses[0].id;
const courseDetails = await client.courses.getCourseDetails(firstCourseId);
console.log(`\n--- Details for Course ID ${firstCourseId} ---`);
console.log(`Description: ${courseDetails.description.substring(0, 100)}...`);
}
} catch (error) {
console.error(`An error occurred: ${error.message}`);
}
}
getCourses();
These examples illustrate the basic pattern of initializing the client, making API calls through its methods, and handling potential errors. Detailed method signatures and return types are documented in the respective SDK documentation.
Community libraries
Beyond the official SDKs, the University of Oslo's developer community contributes a range of unofficial libraries and tools. These community-driven projects often address specific use cases, integrate with niche University services, or offer wrappers in languages not officially supported. While not directly maintained by the University, they can provide valuable resources for developers.
Community libraries are typically found on platforms like GitHub or language-specific package repositories. Their quality, maintenance, and adherence to API changes can vary. Developers considering community libraries should review the project's documentation, activity, and community support. Examples of such libraries might include:
- Rust client for Feide authentication: A library to simplify integration with the Norwegian national identity federation for education and research, Feide.
- Golang wrapper for Room Booking API: A Go-specific client for interacting with the University's room booking system.
- PHP client for Canvas LMS API: While Canvas has its own APIs, a community library might offer specific integrations tailored to the University of Oslo's Canvas instance.
The University of Oslo Developer Portal may feature a section for community contributions or link to external repositories. Developers are encouraged to evaluate community projects based on their licensing, last update, and issue resolution history. For an example of how community-driven API wrappers can emerge, refer to the Google Developers open-source libraries, which feature both official and community projects.