Skip to content

Database

Total endpoints: 11 Example base URL: https://<ROBOT_IP>/rest Required access for this section: USER

Clear All Database

  • Endpoint: /api/v2/clear_database
  • Function: Clear all database.
  • Method: GET
  • Parameters: none
  • Shell Command:
curl -L "https://<ROBOT_IP>/rest/api/v2/clear_database" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/clear_database"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
null

Add Item To Table

  • Endpoint: /api/v2/database/add_item/
  • Function: Add item to table.
  • Method: POST
  • Parameters:
  • data (body, DatabaseItem)
  • Shell Command:
curl -X POST "https://<ROBOT_IP>/rest/api/v2/database/add_item/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"tablename": "example", "item": {"key": "value"}}'
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/add_item/"
headers = {"Authorization": "Bearer <token>"}
json_payload = {'tablename': 'example', 'item': {'key': 'value'}}
response = requests.post(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "Operation completed successfully."
}

Clear Table By Name

  • Endpoint: /api/v2/database/clear_table/
  • Function: Clear table by name route.
  • Method: DELETE
  • Parameters:
  • tablename (query, str)
  • Shell Command:
curl -X DELETE "https://<ROBOT_IP>/rest/api/v2/database/clear_table/?tablename=example" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/clear_table/"
headers = {"Authorization": "Bearer <token>"}
params = {'tablename': 'example'}
response = requests.delete(url, headers=headers, params=params, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "Operation completed successfully."
}

Remove Item To Table

  • Endpoint: /api/v2/database/delete_item/
  • Function: Remove item to table.
  • Method: DELETE
  • Parameters:
  • data (body, DatabaseItem)
  • Shell Command:
curl -X DELETE "https://<ROBOT_IP>/rest/api/v2/database/delete_item/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"tablename": "example", "item": {"key": "value"}}'
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/delete_item/"
headers = {"Authorization": "Bearer <token>"}
json_payload = {'tablename': 'example', 'item': {'key': 'value'}}
response = requests.delete(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "Operation completed successfully."
}

Export Table

  • Endpoint: /api/v2/database/export_table/
  • Function: Export table.
  • Method: POST
  • Parameters:
  • data (body, LoadDatabase)
  • Shell Command:
curl -X POST "https://<ROBOT_IP>/rest/api/v2/database/export_table/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"path": "example", "tablename": "example"}'
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/export_table/"
headers = {"Authorization": "Bearer <token>"}
json_payload = {'path': 'example', 'tablename': 'example'}
response = requests.post(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "La table runes_table a été exportée avec succès vers /tmp/wizard.db"
}

Get Path

  • Endpoint: /api/v2/database/get_path/
  • Function: Get path.
  • Method: GET
  • Parameters: none
  • Shell Command:
curl -L "https://<ROBOT_IP>/rest/api/v2/database/get_path/" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/get_path/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "L'url de la base de données a été trouvé avec succès",
  "data": "sqlite:////home/enchanted/.wizard/database.db"
}

Import Table

  • Endpoint: /api/v2/database/import_table/
  • Function: Import table.
  • Method: POST
  • Parameters:
  • data (body, LoadDatabase)
  • Shell Command:
curl -X POST "https://<ROBOT_IP>/rest/api/v2/database/import_table/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"path": "example", "tablename": "example"}'
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/import_table/"
headers = {"Authorization": "Bearer <token>"}
json_payload = {'path': 'example', 'tablename': 'example'}
response = requests.post(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "La table runes_table a été importée avec succès depuis /tmp/wizard.db"
}

Read Table Data

  • Endpoint: /api/v2/database/read/
  • Function: Read table data.
  • Method: GET
  • Parameters:
  • tablename (query, str)
  • Shell Command:
curl -L "https://<ROBOT_IP>/rest/api/v2/database/read/?tablename=example" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/read/"
headers = {"Authorization": "Bearer <token>"}
params = {'tablename': 'example'}
response = requests.get(url, headers=headers, params=params, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
[
  {
    "id": 1,
    "name": "example"
  }
]

Read Item From Table

  • Endpoint: /api/v2/database/read_item/
  • Function: Read item from table.
  • Method: GET
  • Parameters:
  • data (query, str)
  • Shell Command:
curl -L "https://<ROBOT_IP>/rest/api/v2/database/read_item/?data=example" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/database/read_item/"
headers = {"Authorization": "Bearer <token>"}
params = {'data': 'example'}
response = requests.get(url, headers=headers, params=params, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "id": 1,
  "name": "example"
}

Update Controller Config

  • Endpoint: /api/v2/database/update_controller_config/
  • Function: Update controller config.
  • Method: PUT
  • Parameters:
  • data (body, GamepadConfigModel)
  • Shell Command:
curl -X PUT "https://<ROBOT_IP>/rest/api/v2/database/update_controller_config/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"id": 1, "name": "example", "prompt_name": "example", "config": [{"touch": "example", "simpleClick": ["example"], "doubleClick": ["example"]}]}'
  • Python Command:

```python import requests

url = "https:///rest/api/v2/database/update_controller_config/" headers = {"Authorization": "Bearer "} json_payload = {'id': 1, 'name': 'example', 'prompt_name': 'example', 'config': [{'touch': 'example', 'simpleClick': ['example'], 'doubleClick': ['example']}]} response = requests.put(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code) print(response.json()) ```

  • Response Example (200):
{
  "message": "Operation completed successfully."
}

Update Item Attribute In Table

  • Endpoint: /api/v2/database/update_item/
  • Function: Update item attribute in table.
  • Method: PUT
  • Parameters:
  • data (body, UpdateRequest)
  • Shell Command:
curl -X PUT "https://<ROBOT_IP>/rest/api/v2/database/update_item/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"tablename": "example", "item": {"key": "value"}, "attribute": "example", "new_value": "value"}'
  • Python Command:

```python import requests

url = "https:///rest/api/v2/database/update_item/" headers = {"Authorization": "Bearer "} json_payload = {'tablename': 'example', 'item': {'key': 'value'}, 'attribute': 'example', 'new_value': 'value'} response = requests.put(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code) print(response.json()) ```

  • Response Example (200):
{
  "message": "Operation completed successfully."
}