REST API (Django REST Framework) =============================== The **XPARO REST API** allows robots, clients, and backend services to communicate with the XPARO platform using HTTP requests. This API is primarily used for: - Robot registration - Telemetry and log submission - Uploading ROS2 bag recordings - Sending chatbot messages - Managing robot sessions - Updating configuration files The API is implemented using **Django REST Framework (DRF)**. Base URL -------- ``` https://xparo-website.onrender.com/ ``` Example endpoint ---------------- ``` https://xparo-website.onrender.com/api/upload_rosbag/ ``` Authentication -------------- Most endpoints require authentication using either a **Project Secret Key** or an **API Token**. **Header authentication** .. code-block:: http Authorization: Bearer **URL authentication** .. code-block:: http POST /chatbot_api/// Common endpoints ---------------- .. list-table:: :header-rows: 1 :widths: 25 10 65 * - Endpoint - Method - Description * - ``/chatbot_api///`` - POST - Send message to chatbot * - ``/api/upload_rosbag/`` - POST - Upload ROS2 bag files * - ``/api/robot-info/`` - POST - Register or update robot info * - ``/api/log-session/`` - POST - Create logging session * - ``/api/update-logs/`` - POST - Update telemetry logs * - ``/api/config/`` - GET - Retrieve configuration files Chatbot API ----------- **Endpoint** ``` POST /chatbot_api/// ``` **Request body (JSON)** .. code-block:: json { "message": "Hello robot", "robot_id": "robot_123", "session_id": "session_456" } **Response example** .. code-block:: json { "response": "Hello, how can I assist you?", "actions": [], "behavior_update": false } Robot registration ------------------ **Endpoint** ``` POST /api/robot-info/ ``` **Request example** .. code-block:: json { "robot_id": "robot_123", "os": "Ubuntu 24.04", "cpu": "ARM64", "memory": "8GB", "ip_address": "192.168.1.10", "display": "1920x1080" } **Response** .. code-block:: json { "status": "registered", "robot_id": "robot_123" } Logging session --------------- **Endpoint** ``` POST /api/log-session/ ``` **Request** .. code-block:: json { "robot_id": "robot_123", "project_id": "project_abc" } **Response** .. code-block:: json { "session_id": "session_987", "status": "active" } Update telemetry ---------------- **Endpoint** ``` POST /api/update-logs/ ``` **Request example** .. code-block:: json { "session_id": "session_987", "cpu_usage": 45, "memory_usage": 62, "disk_usage": 30, "logs": [ "Node started", "Navigation goal received" ] } **Response** .. code-block:: json { "status": "updated" } Upload ROS2 bag files --------------------- **Endpoint** ``` POST /api/upload_rosbag/ ``` **Headers** .. code-block:: http Authorization: Bearer **Multipart request fields** - ``file``: multipart file upload (the `.mcap` file) - ``robot_id``: robot identifier - ``timestamp``: epoch timestamp **Response** .. code-block:: json { "status": "uploaded", "file": "bag_2026_03_06.mcap" } Configuration API ----------------- **Endpoint** ``` GET /api/config/ ``` **Response example** .. code-block:: json { "behavior_tree": "...", "maps": "...", "properties": "...", "sets": "..." } Error responses --------------- Common error codes: - 400 — Invalid request - 401 — Authentication failed - 403 — Permission denied - 404 — Resource not found - 500 — Internal server error Example: .. code-block:: json { "error": "Authentication failed" } Security -------- - Always use HTTPS - Store API tokens securely - Rotate tokens periodically - Validate incoming robot IDs Versioning ---------- The live API is versioned. Example patterns: - ``/api/v1/...`` - ``/api/v2/...`` Contact ------- - Email: ``xpassistantpersonal@gmail.com`` - Repo: ``https://github.com/lazyxcientist/`` - Website: ``https://xparo-website.onrender.com/`` .. raw:: html .. raw:: html .. raw:: html
.. raw:: html