Skip to main content

Update delivery request

Updates the specified values for a delivery request. Only "In process" and "scheduled" delivery request can be edited.

 PATCH /api/1.0/request/{deliveryRequestId}

Body

All parameters are optional


containers: <Integer> Number of containers. value between 0 and 10 (kg),
urgent: <Integer> 0 = not urgent, 1 = urgent,
comments: <String> Comments for the delivery,

Response

Model: application/json


{
"id": <Integer> the unique id of the drone
"urgent": <boolean> The request urgency,
"from": <String> The request base uuid (from),
"to": <String> The request base uuid (t),
"comments": <String> Requst comments,
"status": <String> Requst status ("In process", "Scheduled", "Out for delivery","Completed"),
"containers": <Integer> Number of containers for the delivery,
"operation": <String> Sync id corresponding to the operatin manging the delivery
}

tip

When the delivery request is created the operation is not yet assigned, this value will be present when the deivery request is attached to the operation.

Example

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/request/41`, {
mode: "cors",
method: "PATCH",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
body: JSON.stringify({
"comments":"test comments"
}),
})
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": 26,
"from": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"to": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"status": "In process",
"urgent": false,
"comments": "test comments",
"containers": 2,
"operation": null
}