Get operation flightlog
Retrieves operation flightlog file. The endpoint returns a blob witht the file content.
GET /api/1.0/operation/{operationId}/flightlog
Response
Model: application/json
'application/x-binary'
Blob {
[Symbol(type)]: 'application/x-binary',
[Symbol(buffer)]: <Buffer> "Binnary buffer"
}
Example
Example retrieving the file and saving it with nodejs
const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`http://127.0.0.1:1337/api/1.0/operation/145/flightlog`, {
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.blob()
}
response = { data:j };
const {data, message} = response
if(message) console.debug(message)
if(data) console.debug(data)
const buffer=await data.text()
fs.createWriteStream("flightlog.ulg").write(buffer);
}
fetchData()
Answer:
The file is created in the specified directory