API Usage Guides
Learn how to integrate with the AOJ API effectively
Authentication
Learn how to authenticate with the AOJ API using session-based authentication.
Login Example
POST /session Content-Type: application/json { "id": "your_username", "password": "your_password" }
Getting Started
Quick start guide to begin using the AOJ API in your applications.
- Create an account on Aizu Online Judge
- Authenticate using the /session endpoint
- Use the session cookie for subsequent requests
- Explore available endpoints in the API documentation
Common Use Cases
Examples of common scenarios when using the AOJ API.
- •Fetching user profile and statistics
- •Retrieving problem information and test cases
- •Submitting solutions and checking status
- •Accessing course and assignment data
Rate Limits
Understanding API rate limits and best practices.
Important Note
Be respectful of the API and avoid making too many concurrent requests. Implement proper error handling and retry logic in your applications.
Code Examples
JavaScript/Node.js Example
const axios = require('axios'); class AOJClient { constructor(baseURL = 'https://judgeapi.u-aizu.ac.jp') { this.client = axios.create({ baseURL }); } async login(username, password) { const response = await this.client.post('/session', { id: username, password: password }); // Store session cookie const cookies = response.headers['set-cookie']; if (cookies) { this.client.defaults.headers.Cookie = cookies.join('; '); } return response.data; } async getUserInfo() { const response = await this.client.get('/self'); return response.data; } } // Usage const client = new AOJClient(); await client.login('username', 'password'); const userInfo = await client.getUserInfo();
Python Example
import requests class AOJClient: def __init__(self, base_url='https://judgeapi.u-aizu.ac.jp'): self.base_url = base_url self.session = requests.Session() def login(self, username, password): response = self.session.post(f'{self.base_url}/session', json={ 'id': username, 'password': password }) response.raise_for_status() return response.json() def get_user_info(self): response = self.session.get(f'{self.base_url}/self') response.raise_for_status() return response.json() # Usage client = AOJClient() client.login('username', 'password') user_info = client.get_user_info()