Reset simulator battery
This endpoint resets the battery of a running simulator with the specified Id. The get the id you can list all the simulators first with the get-drones endpoint. Stopping and starting the simulator will also reset its battery, but we recommend to use this endpoint as the processing ime will be shorter.
POST /api/1.0/simulator/{simulatord}/reset_battery
Response
Model: application/json
{
"status": <Boolean> True if the simulator start request is accepted,
}
Example
const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`/api/1.0/simulator/41/reset_battery`, {
mode: "cors",
method: "POST",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
body: "",
})
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:
{
"status: true,
}