curl -X GET 'https://api.weir.ai/logs/search?type=ERROR&scheme=admin&searchTerm=failed&page=1&limit=10&startDate=2024-01-01&endDate=2024-01-31' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN'
{
"data": {
"logs": [
{
"logId": "log_123456789",
"type": "ERROR",
"message": "Operation failed: Connection timeout",
"timestamp": "2024-01-22T15:30:00Z",
"scheme": "admin",
"metadata": {
"userId": "user_123",
"endpoint": "/api/endpoint"
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"totalPages": 1
}
},
"message": "Logs retrieved successfully",
"status": "success"
}
Search system logs with filters
curl -X GET 'https://api.weir.ai/logs/search?type=ERROR&scheme=admin&searchTerm=failed&page=1&limit=10&startDate=2024-01-01&endDate=2024-01-31' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN'
{
"data": {
"logs": [
{
"logId": "log_123456789",
"type": "ERROR",
"message": "Operation failed: Connection timeout",
"timestamp": "2024-01-22T15:30:00Z",
"scheme": "admin",
"metadata": {
"userId": "user_123",
"endpoint": "/api/endpoint"
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"totalPages": 1
}
},
"message": "Logs retrieved successfully",
"status": "success"
}
curl -X GET 'https://api.weir.ai/logs/search?type=ERROR&scheme=admin&searchTerm=failed&page=1&limit=10&startDate=2024-01-01&endDate=2024-01-31' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN'
{
"data": {
"logs": [
{
"logId": "log_123456789",
"type": "ERROR",
"message": "Operation failed: Connection timeout",
"timestamp": "2024-01-22T15:30:00Z",
"scheme": "admin",
"metadata": {
"userId": "user_123",
"endpoint": "/api/endpoint"
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"totalPages": 1
}
},
"message": "Logs retrieved successfully",
"status": "success"
}
const searchLogs = async (filters, accessToken) => {
const params = new URLSearchParams(filters);
const response = await fetch(`https://api.weir.ai/logs/search?${params}`, {
headers: { 'Authorization': `Bearer ${accessToken}` }
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
// Usage
const logs = await searchLogs({
type: 'ERROR',
scheme: 'admin',
searchTerm: 'failed',
page: 1,
limit: 20,
startDate: '2024-01-01',
endDate: '2024-01-31'
}, 'your_access_token');
Was this page helpful?