File Management
These endpoints handle the uploading, listing, and deletion of telemetry data (Rosbags, CSVs, Zips) for specific missions.
Upload Files
Section titled “Upload Files”Uploads calibration or data files for a mission. This endpoint handles multipart form data.
- Endpoint:
/api/file/upload - Method:
POST
Request Headers
Section titled “Request Headers”| Key | Value | Required |
|---|---|---|
Content-Type | multipart/form-data | Yes |
X-API-KEY | Your-API-Key | Yes |
Request Body (Form Data)
Section titled “Request Body (Form Data)”| Parameter | Type | Required | Description |
|---|---|---|---|
robot_id | uuid | Yes | The UUID of the robot. |
mission_id | uuid | Yes | The UUID of the mission. |
file_type | string | Yes | Type of file (e.g., calib_file, process_file). |
files | binary | Yes | One or more files to upload (e.g., .bag, .zip, .csv). |
Success Response
Section titled “Success Response”Code: 200 OK
{ "data": { "details": { "failed_files": [], "file type": "calib_file", "original_filenames": [ "Day1.bag", "Day10.bag" ], "success": true, "uploaded_files": [ "7fec2dd2-e29b-41d4-a716-446655440000_Day1.bag", "42b020b1-e29b-41d4-a716-446655440000_Day10.bag" ] }, "mission_id": "9384ac10-e29b-41d4-a716-446655440000", "org_id": "b8c16c60-e29b-41d4-a716-446655440000", "robot_id": "e7201eff-e29b-41d4-a716-446655440000" }, "errors": null, "message": "Files uploaded successfully", "success": true}Possible Errors
Section titled “Possible Errors”- RS-MSN-002: Mission ID not found.
- RS-VAL-005: Invalid file type.
- 401 Unauthorized: Invalid or missing API Key.
Sample Code (Python)
Section titled “Sample Code (Python)”import requests
url = "[https://api.ridescan.ai/api/file/upload](https://api.ridescan.ai/api/file/upload)"headers = { "X-API-KEY": "YOUR_API_KEY" # Content-Type is set automatically by requests for multipart uploads}
# The 'files' list contains tuples: (field_name, (filename, file_object, content_type))files = [ ('files', ('Day1.bag', open('path/to/Day1.bag', 'rb'), 'application/octet-stream')), ('files', ('Day10.bag', open('path/to/Day10.bag', 'rb'), 'application/octet-stream'))]
data = { "robot_id": "e7201eff-e29b-41d4-a716-446655440000", "mission_id": "9384ac10-e29b-41d4-a716-446655440000", "file_type": "calib_file"}
response = requests.post(url, headers=headers, data=data, files=files)print(response.json())List Files
Section titled “List Files”Retrieve a list of all files associated with a specific mission.
- Endpoint:
/api/files/list - Method:
GET
Request Headers
Section titled “Request Headers”| Key | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
X-API-KEY | Your-API-Key | Yes |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
robot_id | uuid | Yes | Robot UUID. |
mission_id | uuid | Yes | Mission UUID. |
Success Response
Section titled “Success Response”Code: 200 OK
{ "success": true, "data": { "files": [ { "file_size": 10240, "original_filename": "Day1.bag", "risk_score": null, "unique_filename": "7fec2dd2-e29b-41d4-a716-446655440000_Day1.bag" } ] }}Possible Errors
Section titled “Possible Errors”- RS-MSN-002: Mission ID not found.
- 401 Unauthorized: Invalid or missing API Key.
Sample Code (Python)
Section titled “Sample Code (Python)”import requests
url = "[https://api.ridescan.ai/api/files/list](https://api.ridescan.ai/api/files/list)"headers = { "Content-Type": "application/json", "X-API-KEY": "YOUR_API_KEY"}params = { "robot_id": "e7201eff-e29b-41d4-a716-446655440000", "mission_id": "9384ac10-e29b-41d4-a716-446655440000"}
response = requests.get(url, params=params, headers=headers)print(response.json())Delete File
Section titled “Delete File”Permanently removes a specific file from storage and the database.
- Endpoint:
/api/blob/delete - Method:
DELETE
Request Headers
Section titled “Request Headers”| Key | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
X-API-KEY | Your-API-Key | Yes |
Request Body
Section titled “Request Body”| Parameter | Type | Required | Description |
|---|---|---|---|
robot_pid | uuid | Yes | Robot UUID (Note: Use robot_pid, not robot_id). |
mission_pid | uuid | Yes | Mission UUID (Note: Use mission_pid, not mission_id). |
filename | string | Yes | The unique filename returned from the List Files endpoint. |
Success Response
Section titled “Success Response”Code: 200 OK
{ "data": null, "errors": null, "message": "Blob and DB record deleted successfully", "success": true}Possible Errors
Section titled “Possible Errors”- RS-FILE-001: File not found.
- RS-MSN-002: Mission ID not found.
- 401 Unauthorized: Invalid or missing API Key.
Sample Code (Python)
Section titled “Sample Code (Python)”import requests
url = "[https://api.ridescan.ai/api/blob/delete](https://api.ridescan.ai/api/blob/delete)"headers = { "Content-Type": "application/json", "X-API-KEY": "YOUR_API_KEY"}payload = { "robot_pid": "e7201eff-e29b-41d4-a716-446655440000", "mission_pid": "9384ac10-e29b-41d4-a716-446655440000", "filename": "7fec2dd2-e29b-41d4-a716-446655440000_Day1.bag"}
response = requests.delete(url, json=payload, headers=headers)print(response.json())