Closed tsaubergine closed 3 weeks ago
Is v1 short for API version 1?
What is hub metadata? And how does it relate to metadata that gets recorded into the goby logs? As a user, I guess I would expect it to be the same or close to.
Is v1 short for API version 1?
Yes
What is hub metadata? And how does it relate to metadata that gets recorded into the goby logs? As a user, I guess I would expect it to be the same or close to.
Same message. We don't currently send the bot metadata over XBee so this isn't available at runtime but we could do it over WiFi in the future.
What's the syntax to activate one bot only?
Would it be
import requests res = requests.post('http://10.23.1.11:9092/jaia/v1', json={"target": {"all": False, "bots": [1]}, "command": { "type": "ACTIVATE"}, "api_key": "4vS6s2jnulxVjrKSB-__tQ"})
?
Would it be
!/usr/bin/env python3 import requests res = requests.post('http://10.23.1.11:9092/jaia/v1', json={"target": {"all": False, "bots": [1]}, "command": { "type": "ACTIVATE"}, "api_key": "4vS6s2jnulxVjrKSB-__tQ"})
?
Exactly, though you can omit "all": False
as that's the default in the protobuf if not included:
10.23.1.11:9092/jaia/v1/command/b1?type=ACTIVATE&api_key=4vS6s2jnulxVjrKSB-__tQ
or
res = requests.post('http://10.23.1.11:9092/jaia/v1', json={"target": {"bots": [1]}, "command": { "type": "ACTIVATE"}, "api_key": "4vS6s2jnulxVjrKSB-__tQ"})
I forgot to mention the 3 endpoint URLs mentioned in the JED app.
Thanks for updating those!
jaia doc rest_api is not working for me.
ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api
Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc)
ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ sudo apt install jaiabot-doc
[sudo] password for ferrom:
Reading package lists... Done
Building dependency tree
Reading state information... Done
jaiabot-doc is already the newest version (1.11.0+46+gb3285e16-0~ubuntu20.04.1).
The following packages were automatically installed and are no longer required:
docker-scan-plugin linux-headers-5.4.0-144 linux-headers-5.4.0-144-generic linux-headers-5.4.0-146 linux-headers-5.4.0-146-generic linux-headers-5.4.0-150
linux-headers-5.4.0-150-generic linux-headers-5.4.0-155 linux-headers-5.4.0-155-generic linux-headers-5.4.0-156 linux-headers-5.4.0-156-generic linux-headers-5.4.0-163
linux-headers-5.4.0-163-generic linux-headers-5.4.0-167 linux-headers-5.4.0-167-generic linux-headers-5.4.0-170 linux-headers-5.4.0-170-generic linux-headers-5.4.0-174
linux-headers-5.4.0-174-generic linux-headers-5.4.0-176 linux-headers-5.4.0-176-generic linux-headers-5.4.0-177 linux-headers-5.4.0-177-generic linux-headers-5.4.0-182
linux-headers-5.4.0-182-generic linux-tools-5.4.0-163 linux-tools-5.4.0-163-generic linux-tools-5.4.0-167 linux-tools-5.4.0-167-generic linux-tools-5.4.0-170
linux-tools-5.4.0-170-generic linux-tools-5.4.0-174 linux-tools-5.4.0-174-generic linux-tools-5.4.0-176 linux-tools-5.4.0-176-generic linux-tools-5.4.0-177
linux-tools-5.4.0-177-generic linux-tools-5.4.0-182 linux-tools-5.4.0-182-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api
Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc)```
jaia doc rest_api is not working for me.
ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc) ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ sudo apt install jaiabot-doc [sudo] password for ferrom: Reading package lists... Done Building dependency tree Reading state information... Done jaiabot-doc is already the newest version (1.11.0+46+gb3285e16-0~ubuntu20.04.1). The following packages were automatically installed and are no longer required: docker-scan-plugin linux-headers-5.4.0-144 linux-headers-5.4.0-144-generic linux-headers-5.4.0-146 linux-headers-5.4.0-146-generic linux-headers-5.4.0-150 linux-headers-5.4.0-150-generic linux-headers-5.4.0-155 linux-headers-5.4.0-155-generic linux-headers-5.4.0-156 linux-headers-5.4.0-156-generic linux-headers-5.4.0-163 linux-headers-5.4.0-163-generic linux-headers-5.4.0-167 linux-headers-5.4.0-167-generic linux-headers-5.4.0-170 linux-headers-5.4.0-170-generic linux-headers-5.4.0-174 linux-headers-5.4.0-174-generic linux-headers-5.4.0-176 linux-headers-5.4.0-176-generic linux-headers-5.4.0-177 linux-headers-5.4.0-177-generic linux-headers-5.4.0-182 linux-headers-5.4.0-182-generic linux-tools-5.4.0-163 linux-tools-5.4.0-163-generic linux-tools-5.4.0-167 linux-tools-5.4.0-167-generic linux-tools-5.4.0-170 linux-tools-5.4.0-170-generic linux-tools-5.4.0-174 linux-tools-5.4.0-174-generic linux-tools-5.4.0-176 linux-tools-5.4.0-176-generic linux-tools-5.4.0-177 linux-tools-5.4.0-177-generic linux-tools-5.4.0-182 linux-tools-5.4.0-182-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc)```
Well you'll need jaiabot-doc from the test repo at the moment, or just use -Dbuild_doc=ON
to cmake (then make) to show the docs from the local git clone.
jaia doc rest_api is not working for me.
ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc) ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ sudo apt install jaiabot-doc [sudo] password for ferrom: Reading package lists... Done Building dependency tree Reading state information... Done jaiabot-doc is already the newest version (1.11.0+46+gb3285e16-0~ubuntu20.04.1). The following packages were automatically installed and are no longer required: docker-scan-plugin linux-headers-5.4.0-144 linux-headers-5.4.0-144-generic linux-headers-5.4.0-146 linux-headers-5.4.0-146-generic linux-headers-5.4.0-150 linux-headers-5.4.0-150-generic linux-headers-5.4.0-155 linux-headers-5.4.0-155-generic linux-headers-5.4.0-156 linux-headers-5.4.0-156-generic linux-headers-5.4.0-163 linux-headers-5.4.0-163-generic linux-headers-5.4.0-167 linux-headers-5.4.0-167-generic linux-headers-5.4.0-170 linux-headers-5.4.0-170-generic linux-headers-5.4.0-174 linux-headers-5.4.0-174-generic linux-headers-5.4.0-176 linux-headers-5.4.0-176-generic linux-headers-5.4.0-177 linux-headers-5.4.0-177-generic linux-headers-5.4.0-182 linux-headers-5.4.0-182-generic linux-tools-5.4.0-163 linux-tools-5.4.0-163-generic linux-tools-5.4.0-167 linux-tools-5.4.0-167-generic linux-tools-5.4.0-170 linux-tools-5.4.0-170-generic linux-tools-5.4.0-174 linux-tools-5.4.0-174-generic linux-tools-5.4.0-176 linux-tools-5.4.0-176-generic linux-tools-5.4.0-177 linux-tools-5.4.0-177-generic linux-tools-5.4.0-182 linux-tools-5.4.0-182-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ferrom@LAPTOP-AH3AN14A:~/repos/jaiabot$ jaia doc rest_api Could not find any markdown files - ensure that the jaiabot-doc package is installed (sudo apt install jaiabot-doc)```
Well you'll need jaiabot-doc from the test repo at the moment, or just use
-Dbuild_doc=ON
to cmake (then make) to show the docs from the local git clone.
Yes, thank you for pointing that out. I was able to get this to work with your directions.
Web endpoints
This PR implements a new REST API for accessing fleet data and sending commands. It is intended to supercede the preliminary API in the JCC server, which has been renamed to "/jaia/v0" to avoid conflict when running the new REST API and JCC on the same port, that is "/jaia/status" -> "/jaia/v0/status", etc.
This PR implements https://jaia-innovation.atlassian.net/browse/JAIA-1463 and most child issues, except as noted below in Follow-on work
Merged PRs
This PR merges in the following separate PRs for final review:
jaia doc
subtool: https://github.com/jaiarobotics/jaiabot/pull/941Follow-on work
Hosting
The Apache config has been updated to serve /jaia using this new REST API for ports 80 and 443 (https), and /jaia/v0 and / with the JCC server on port 80 (http only).
REST API - Overview
The new API directly introspects from the new APIRequest Protobuf message for input and APIResponse for output. It accepts GET requests for the subset of requests that only have singular (non-repeated) non-recursive (no submessages) data. This is generally suitable for simpler requests (e.g. Stop all bots, query status, etc) but not for more complicated MISSION_PLAN type commands.
It also accepts POST for all requests, using JSON (which will be required for the more complicated messages).
api_key can be omitted for local connections, if we want.
There are 2 variants of the API:
Bot and Hub Status
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
OR (POST full APIRequest)
Task Packets
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
OR (POST)
OR (POST full APIRequest)
Task Packet Count
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxRemoved (though could be added in if important)
Metadata
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
(for hub1 metadata)
OR (POST full APIRequest)
Stop All Bots
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
OR (POST full APIRequest)
Activate All Bots
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
OR (POST full APIRequest)
Single Waypoint Mission
This section is out of date, use
jaia doc rest_api
for the correct precise syntaxOld Input
New Input
Note that this is trivially extendable to a multiple waypoint mission by repeating "goal"
~Can't use GET as we need to pass embedded message with repeated fields~
(POST)
OR (POST full APIRequest)
Testing
To test first start a simulation:
Then start the REST API code with a key (this key is used in the test scripts):
Then run either of tests
or simply use a web browser to test the long API (GET).