Get drone list
Retrieves all available drones into the specified project
GET /api/1.0/drones?project={projectId}
Response
Model: application/json
ARRAY
[
{
"id": <Integer> the unique id of the drone
"serialNumber": <String> The serial number for the drone,
"model": <String> Drone model,
"revision": <string> Revision for the drone,
"registrationDate": <String> Drone registration date into the system,
"simulator": <Boolean> Indicates if is a simulator,
"emptyWeight": <Float> Empty weight for the drone (in kg),
"status": <Integer> Status for the drone (1 = active, 0 = inactive)
}
]
Query parameters
Some parameters are allowed for a filtered response
caution
parameters with * are mandatory
* project: <Integer> - Get drones for that project id
serialNumber: <String> - It will return anything containing this string in serialNumber
simulator: <Integer> - It will return simulators or not simulators, (1=is simulator, 0 = is not simulator)
Example
const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/drones?project=3&serialNumber=GA`, {
mode: "cors",
method: "GET",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
})
if(!serverResponse.ok){
try {
switch (serverResponse.status){
case 400:
j = await serverResponse.json();
break;
case 403:
response = { message: "Forbidden access to data" };
case 404:
response = { message: "Address not found" };
default:
j = await serverResponse.json()
}
} catch (e) {
response = { message: "Error fetching data" };
}
}else{
j = await serverResponse.json()
}
response = { data:j };
const {data, message} = response
if(message) console.debug(message)
if(data) console.debug(data)
}
fetchData()
Answer:
[
{
"id": 41,
"serialNumber": "GA_DEV_CARLOS",
"model": "SimVtol",
"revision": "2",
"registrationDate": "1970-01-01T00:00:00.000Z",
"simulator": true,
"emptyWeight": 10,
"status": 1
},
{
"id": 41,
"serialNumber": "GA_DEV_CARLOS2",
"model": "SimVtol",
"revision": "2",
"registrationDate": "1970-01-01T00:00:00.000Z",
"simulator": true,
"emptyWeight": 10,
"status": 1
}
]