Skip to main content

Update operation

Updates the specified values for a scheduled operation. If the operation is not scheduled an error will be returned

 PATCH /api/1.0/operation/{operationId}

Body

All parameters are optional


name: <String> The new operation name,
scheduledTime: <String date> The operation scheduled time date (YYY-MM-DD HH:mm:ss),
drone: <Integer> The drone id,
route: <Integer> The route id,
payload: <Float> Float value between 0 and 2 (kg),
pic: <Integer> User id for the piclot in command,
groundOperators: <Array> Array of user id representing the ground operators for the operation
deliveryRequests: <Array> Array of delivery requests id for the operation
comments: <String> Comments for the operation,

Response

Model: application/json


{
"status": <Sting> Message with the call status
"id": <Integer> The unique id of the updated operation
"syncId": <String> The unique syncId of the updated operation
}

Example

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/operation/41`, {
mode: "cors",
method: "PATCH",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
body: JSON.stringify({
"name":"test operation api",
"scheduledTime":"2022-07-19 11:00:06",
"route":14,
"payload":"1",
"pic":34,
"groundOperators":[32,39]
}),
})
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: "Operation updated",
"id": 41
"syncId": 16584665126
}