Developer

Sesame Disk for Developers: Connect with Our Seafile REST API

Sesame Disk provides a powerful REST API based on Seafile, allowing developers to integrate secure cloud storage into their applications.

Why Use the Sesame Disk API?

βœ… Automate file management: Upload, download, and organize files programmatically.
βœ… Seamless integration: Connect your app to our cloud without complex configurations.
βœ… Cross-platform support: Works with any programming language that supports HTTP requests.

🌍 API Server Endpoint

All API requests must be sent to our dedicated server:
https://app.nihaoconsult.com/

Make sure to include this base URL in all your API calls. For example, the full endpoint to authenticate would be:

POST https://app.nihaoconsult.com/api2/auth-token/

This ensures your requests are directed to the correct server for secure and seamless integration.


1️⃣Get Your Authentication Token

Before making API requests, you need to authenticate and obtain an access token.

πŸ“Œ Endpoint: POST /api2/auth-token/

πŸ’» Example in cURL

curl -X POST https://app.nihaoconsult.com/api2/auth-token/ \
-d "[email protected]&password=your_password"

πŸ’» Example in Python

import requests

url = "https://app.nihaoconsult.com/api2/auth-token/"
data = {"username": "[email protected]", "password": "your_password"}

response = requests.post(url, data=data)
print(response.json()) # {"token": "your_api_token_here"}

πŸ’» Example in Node.js

const axios = require('axios');

axios.post('https://app.nihaoconsult.com/api2/auth-token/', {
username: '[email protected]',
password: 'your_password'
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

πŸ“Œ Response Example:

{
"token": "your_api_token_here"
}

Save this token, as you’ll need it in all future requests.


2️⃣ Make an API Call

Once authenticated, you can use the token to make API requests.
Here’s how you can list all your libraries (file repositories).

πŸ“Œ Endpoint: GET /api2/repos/

πŸ’» Example in cURL

curl -X GET https://app.nihaoconsult.com/api2/repos/ \
-H "Authorization: Token your_api_token_here"

πŸ’» Example in Python

headers = {"Authorization": "Token your_api_token_here"}
response = requests.get("https://app.nihaoconsult.com/api2/repos/", headers=headers)
print(response.json())

πŸ’» Example in Node.js

axios.get("https://app.nihaoconsult.com/api2/repos/", {
headers: { Authorization: "Token your_api_token_here" }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

πŸ“Œ Example Response:

[
{
"id": "123abc...",
"name": "My Library",
"size": 10485760,
"mtime": 1700000000,
"encrypted": false
}
]

πŸ“Œ Explore More Features

This is just the beginning! With our API, you can:
βœ… Upload & download files
βœ… Create & manage folders
βœ… Share secure links
βœ… Manage user permissions

πŸ“– Check out the full API documentation here:
πŸ”— Seafile API Docs

πŸ’‘ Need help? Contact our support team! πŸš€