REST API Documentation¶
Overview¶
The AIDDDMAP REST API provides programmatic access to the platform's core functionality. This documentation covers authentication, endpoints, and common usage patterns.
Authentication¶
Bearer Token¶
All API requests must include a Bearer token in the Authorization header:
Obtaining Tokens¶
POST /api/auth/token
Content-Type: application/json
{
"username": "your-username",
"password": "your-password"
}
Response:
API Endpoints¶
Data Management¶
List Datasets¶
Query Parameters:
page: Page number (default: 1)limit: Items per page (default: 10)sort: Sort fieldorder: Sort order (asc/desc)
Response:
{
"data": [
{
"id": "dataset-id",
"name": "Dataset Name",
"description": "Description",
"created_at": "2024-01-15T12:00:00Z",
"encryption_status": "encrypted"
}
],
"total": 100,
"page": 1,
"limit": 10
}
Create Dataset¶
POST /api/datasets
Content-Type: application/json
{
"name": "New Dataset",
"description": "Description",
"encryption_mode": "fhe",
"data": {...}
}
Get Dataset¶
Agent Management¶
List Agents¶
Deploy Agent¶
POST /api/agents/deploy
Content-Type: application/json
{
"agent_id": "agent-id",
"configuration": {...}
}
Agent Status¶
UADM Operations¶
Device Registration¶
POST /api/uadm/devices
Content-Type: application/json
{
"device_type": "robot",
"name": "Device Name",
"configuration": {...}
}
Device Control¶
POST /api/uadm/devices/{device_id}/control
Content-Type: application/json
{
"command": "start",
"parameters": {...}
}
Marketplace¶
List Items¶
Create Listing¶
POST /api/marketplace/items
Content-Type: application/json
{
"title": "Item Title",
"description": "Description",
"price": 100,
"dataset_id": "dataset-id"
}
Error Handling¶
Error Response Format¶
Common Error Codes¶
AUTH_REQUIRED: Authentication requiredINVALID_TOKEN: Invalid or expired tokenNOT_FOUND: Resource not foundVALIDATION_ERROR: Invalid input dataPERMISSION_DENIED: Insufficient permissions
Rate Limiting¶
- Rate limit: 1000 requests per hour
- Headers included in responses:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset
Versioning¶
- Current version: v1
- Version specified in URL:
/api/v1/... - Deprecation notice via
API-Deprecationheader
WebSocket API¶
For real-time updates, connect to:
Events¶
// Subscribe to updates
{
"type": "subscribe",
"channel": "dataset_updates",
"dataset_id": "dataset-id"
}
// Receive updates
{
"type": "update",
"data": {...}
}
Examples¶
JavaScript/TypeScript¶
const api = new AIDDDMAPClient({
baseUrl: 'https://api.aidddmap.com',
token: 'your-access-token'
});
// List datasets
const datasets = await api.datasets.list({
page: 1,
limit: 10
});
// Deploy agent
await api.agents.deploy({
agent_id: 'agent-id',
configuration: {...}
});
Python¶
from aidddmap_client import AIDDDMAPClient
client = AIDDDMAPClient(
base_url='https://api.aidddmap.com',
token='your-access-token'
)
# List datasets
datasets = client.datasets.list(
page=1,
limit=10
)
# Deploy agent
client.agents.deploy(
agent_id='agent-id',
configuration={...}
)
Best Practices¶
-
Authentication
-
Store tokens securely
- Refresh tokens before expiry
-
Use environment variables
-
Error Handling
-
Implement retry logic
- Handle rate limits
-
Log errors appropriately
-
Performance
- Use pagination
- Implement caching
- Minimize request frequency
Support¶
- API Status: status.aidddmap.com
- Developer Forum: forum.aidddmap.com
- Email: api-support@aidddmap.com