Get delivery requests list
Retrieves all available delivery requests into the specified project
GET /api/1.0/requests?project={projectId}
Response
Model: application/json
ARRAY
[
{
"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
}
]
Query parameters
Some parameters are allowed for a filtered response
caution
parameters with * are mandatory
* project: <Integer> - Get drones for that project id
status: <Integer> - will retunr operations with this status (1="In process", 2="Scheduled", 3="Out for delivery", 4="Completed"). Multiple status are allowed separated by comma.
Example
const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/requests?project=3&status=1`, {
mode: "cors",
method: "GET",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
})
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": 23,
"urgent": false,
"from": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"to": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"comments": "A description to add",
"status": "In process",
"containers": 2,
"operation": null
},
{
"id": 22,
"urgent": false,
"from": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"to": "40f98fcf-38f9-4a08-aea5-831bd5eb8fd8",
"comments": "A description to add",
"status": "In process",
"containers": 2,
"operation": null
}
]