curl -X POST 'https://api.weir.ai/console/logs/export' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"format": "csv",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"type": "ERROR"
}'
{
"data": {
"exportId": "export_123456789",
"format": "csv",
"status": "processing",
"downloadUrl": null,
"expiresAt": "2024-01-23T15:30:00Z"
},
"message": "Log export initiated successfully",
"status": "success"
}
Export logs to CSV or JSON format
curl -X POST 'https://api.weir.ai/console/logs/export' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"format": "csv",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"type": "ERROR"
}'
{
"data": {
"exportId": "export_123456789",
"format": "csv",
"status": "processing",
"downloadUrl": null,
"expiresAt": "2024-01-23T15:30:00Z"
},
"message": "Log export initiated successfully",
"status": "success"
}
curl -X POST 'https://api.weir.ai/console/logs/export' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"format": "csv",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"type": "ERROR"
}'
{
"data": {
"exportId": "export_123456789",
"format": "csv",
"status": "processing",
"downloadUrl": null,
"expiresAt": "2024-01-23T15:30:00Z"
},
"message": "Log export initiated successfully",
"status": "success"
}
const exportLogs = async (exportOptions, accessToken) => {
const response = await fetch('https://api.weir.ai/console/logs/export', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'x-source': 'console'
},
body: JSON.stringify(exportOptions)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
Was this page helpful?