Skip to main content

Update route

Updates the specified values for a route.

 POST /api/1.0/route/{routeId}

Body

caution

Follow correctly the flightplan format or the server will reject the plan creation.

you can find the flightplan format in the flightplan-format section


* project: <Integer> The project id,
routename: <String> The new route name,
flightPlan: <Object> Json object containing the flight plan for the route,
routestate: <String> Route state for the route ("draft", "validated", "authorized"). "Draft" is set if not specified

Response

Model: application/json


{
"status": <Sting> Message with the call status ("accepted", "rejected")
"route": <Object> Json object containing the route data
id: <Integer> route id
name: <String> route name
routeState: <String> route state ("draft", "validated", "authorized")
flightPlan: <Object> Json flightPlan
}

Example

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/route/1843`, {
mode: "cors",
method: "PATCH",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
body: JSON.stringify({
"name":"updated route",
}),
})
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,
"route":{
"id": 1843,
"name": "Updated route",
"routeState": "authorized",
"flightPlan":{"fileType": "Plan", "safetySettings":{}, "geoFence":{"circles":[],…}
}
}