Endpoints by Data Type
Each endpoint has an associated functionality described, along with example shell and Python commands to interact with the API.
1. Coordinates
- Endpoint:
/api/v1/coordinates/
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/coordinates/" \
-H "Content-Type: application/json" \
-d '{"command": "<command>", "value": {"x": 1.5, "y": -0.5, "z": 0.0, "theta": 3.14}}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/coordinates/"
data = {
"command": "<command>",
"value": {"x": 1.5, "y": -0.5, "z": 0.0, "theta": 3.14}
}
response = requests.post(url, json=data)
print(response.text)
- Note: NO COMMAND IS USING THIS ENDPOINT
2. Float
- Endpoint:
/api/v1/float/
- Function example: Sets the maximum velocity at which the robot can operate in percentage
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/int/" \
-H "Content-Type: application/json" \
-d '{"command": "set_robot_max_velocity", "value": 50}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/int/"
data = {
"command": "set_robot_max_velocity",
"value": 50
}
response = requests.post(url, json=data)
print(response.text)
3. Int
- Endpoint:
/api/v1/int/
- Function example: Adjusts the sound level setting.
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/float/" \
-H "Content-Type: application/json" \
-d '{"command": "sound_level", "value": 85}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/float/"
data = {
"command": "sound_level",
"value": 85
}
response = requests.post(url, json=data)
print(response.text)
4. String
- Endpoint:
/api/v1/str/
- Function example: Checks if a rune has been detected.
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/str/" \
-H "Content-Type: application/json" \
-d '{"command": "is_detected", "value": "rune_id"}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/str/"
data = {
"command": "is_detected",
"value": "rune_id"
}
response = requests.post(url, json=data)
print(response.text)
5. Boolean
- Endpoint:
/api/v1/bool/
- Function example: Toggles the obstacle avoidance feature.
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/bool/" \
-H "Content-Type: application/json" \
-d '{"command": "set_obstacle_avoidance", "value": "true"}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/bool/"
data = {
"command": "set_obstacle_avoidance",
"value": True # Use Python's boolean True instead of the string "true"
}
response = requests.post(url, json=data)
print(response.text)
6. Dictionary
- Endpoint:
/api/v1/dict/
- Function example: Trigger a wave animation.
- Method::
POST
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/dict/" \
-H "Content-Type: application/json" \
-d '{"command": "skill", "value": {name: wave}}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/dict/"
data = {
"command": "skill",
"value": {"name": "wave"}}
}
response = requests.post(url, json=data)
print(response.text)
7. Get / Commands with no argument
This endpoint is to send either a command with no argument, either to get data.
- Endpoint: /api/v1/get/{command}/
- Function example: Get robot's language.
- Method:: GET
- Shell Command:
curl -L "http://<ROBOT_IP>:8000/api/v1/get/get_language/"
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/get/get_language/"
response = requests.get(url)
print(response.text)
8. Get available services list
This endpoint is to get available services list.
- Endpoint:
/api/v1/service/get_services_list/
- Function example: Get robot's services list for head and base
- Method::
GET
- Shell Command:
curl -L "http://<ROBOT_IP>:8000/api/v1/service/get_services_list/"
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/service/get_services_list/"
response = requests.get(url)
print(response.text)
9. Get services logs
This endpoint is to get last hour services logs from user services of a specific system (head or base).
- Endpoint:
/api/v1/service/{system_name}/{service_name}
- Function example: Get logs of
enchanted_stack.service for the base.
- Method::
GET
- Shell Command:
curl -L "http://<ROBOT_IP>:8000/api/v1/service/base/enchanted_stack.service/"
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/service/base/enchanted_stack.service/"
response = requests.get(url)
print(response.text)
Each endpoint except NoArgCommand supports a POST method where JSON data can be sent as part of the request to interact with different functionalities provided by the API.
Skill Management Endpoints
Each endpoint below is used for handling skill management on the robot, including uploading, removing, listing, and enabling/disabling skills.
1. Upload Skill
- Endpoint:
/api/v1/skill/upload/
- Method:
POST
- Functionality: Uploads a skill file to the robot.
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/skill/upload/" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "skill=@/path/to/skill.py"
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/skill/upload/"
headers = {"Authorization": "Bearer <token>"}
files = {"skill": open("/path/to/skill.py", "rb")}
response = requests.post(url, headers=headers, files=files)
print(response.json())
2. Remove Skill
- Endpoint:
/api/v1/skill/remove/
- Method:
POST
- Functionality: Removes a skill file from the robot.
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/skill/remove/" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"skill_name": "skill.py"}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/skill/remove/"
headers = {"Authorization": "Bearer <token>", "Content-Type": "application/json"}
data = {"skill_name": "skill.py"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
3. Get Skills List
- Endpoint:
/api/v1/skill/list/
- Method:
GET
- Functionality: Retrieves a list of available skill files on the robot.
- Shell Command:
curl -L "http://<ROBOT_IP>:8000/api/v1/skill/list/" \
-H "Authorization: Bearer <token>"
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/skill/list/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.json())
4. Enable/Disable Skill
- Endpoint:
/api/v1/skill/enable/
- Method:
POST
- Functionality: Enables or disables a skill.
- Shell Command:
curl -X POST "http://<ROBOT_IP>:8000/api/v1/skill/enable/" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"command": "skill.py", "value": true}'
- Python Command:
import requests
url = "http://<ROBOT_IP>:8000/api/v1/skill/enable/"
headers = {"Authorization": "Bearer <token>", "Content-Type": "application/json"}
data = {"command": "skill.py", "value": True}
response = requests.post(url, headers=headers, json=data)
print(response.json())