Create new route
Creates a new route into the specific project
POST /api/1.0/route
caution
parameters with * are mandatory
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`, {
"project":"17",
"routename":"Test route 3",
"routestate":"validated",
"flightPlan":{
"geoFence":{
"polygons": [
{
"type": "geocage",
"altAmsl": 606,
"inclusion": "inclusion",
"vertices": [
{
"lat":49.150077591022544,
"lon":16.825107180165574
},
{
"lat":49.1525792724473,
"lon":16.82125552802019
},
{
"lat":49.15376165013778,
"lon":16.81496843008928
},
{
"lat":49.159680131436424,
"lon":16.797056638287827
},
{
"lat":49.16061853343021,
"lon":16.78889467625551
},
{
"lat":49.1588066122935,
"lon":16.781934343861863
},
{
"lat":49.156665723624045,
"lon":16.763573282050416
},
{
"lat":49.154121708361615,
"lon":16.75222552626066
},
{
"lat":49.15045478109202,
"lon":16.749031685876176
},
{
"lat":49.15087034473323,
"lon":16.73482838331394
},
{
"lat":49.15204377237618,
"lon":16.728736080812737
},
{
"lat":49.15747909242239,
"lon":16.718050998287723
},
{
"lat":49.15871855242119,
"lon":16.707182896906957
},
{
"lat":49.15592011697326,
"lon":16.697717433680296
},
{
"lat":49.15532924349978,
"lon":16.69664389261881
},
{
"lat":49.15410684189552,
"lon":16.699218155817576
},
{
"lat": 49.15394953255132,
"lon":16.705954549951926
},
{
"lat":49.152632613814326,
"lon":16.71185015014045
},
{
"lat":49.1453995376264,
"lon":16.723716661917493
},
{
"lat":49.144687954965214,
"lon":16.73247223033242
},
{
"lat":49.14278810311593,
"lon":16.738223305555508
},
{
"lat":49.14037824223416,
"lon":16.739596806118712
},
{
"lat":49.140354745397154,
"lon":16.74912422208719
},
{
"lat":49.14489181364054,
"lon":16.757474609302804
},
{
"lat":49.1466213436577,
"lon":16.76951571612291
},
{
"lat":49.142827966263894,
"lon":16.777396046208665
},
{
"lat":49.146266933091326,
"lon":16.795914017247483
},
{
"lat":49.14568092194048,
"lon":16.80801614432268
},
{
"lat":49.14392284690498,
"lon":16.810891472386643
},
{
"lat":49.142629692022375,
"lon":16.81568189768724
},
{
"lat":49.14238228676779,
"lon":16.821888529347703
},
{
"lat":49.14256827948575,
"lon":16.825053535985276
},
{
"lat":49.144357985057624,
"lon":16.82549341826372
},
{
"lat":49.14684942832515,
"lon":16.82568653731279
}
]
}]
},
"mission": [
{
"altAmsl": 350,
"padAltAmsl": 267,
"command": 22,
"lat":49.15108304952246,
"lon":16.79625748449217
},
{
"altAmsl": 350,
"command": 16,
"lat":49.15052165642498,
"lon":16.763470161494123
},
{
"altAmsl": 350,
"command": 3000,
"lat":49.15052165642498,
"lon":16.763470161494123,
"transitionType":"front"
},
{
"altAmsl": 350,
"command": 16,
"lat":49.14911814584975,
"lon":16.754372108515607
},
{
"altAmsl": 350,
"command": 3000,
"lat":49.146872446229374,
"lon":16.745960701044904,
"transitionType":"back"
},
{
"command": 21,
"altAmsl": 360,
"lat":49.147939166240384,
"lon":16.732141960200178,
"padAltAmsl": 350
}
],
"rallyPoints": [
{
"altAmsl": 350,
"lat":49.15916640477572,
"lon":16.80844544225584
},
{
"lat":49.16489131666681,
"lon":16.78097962194334
}
]
}
}
)
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:
caution
The flightPlan returned will consist in the flightPlan sent for the creation populated with extra data like extra altitudes, uuid's etc. This is the final plan saved into the system
{
"status": true,
"route":{
"id": 1955,
"name": "Test route 3 (3)",
"routeState": "validated",
"flightPlan":{"uuid": "fdf47a5f-63bc-48c0-be1f-36ced889ba67", "version": 2, "safetySettings":{}, "safetyProfile": null,…}
}
}