curl -X POST 'https://api.weir.ai/logs/log?scheme=admin' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"type": "INFO",
"message": "System operation completed",
"dateTime": "2024-01-22T15:30:00.000Z"
}'
{
"data": {
"logId": "log_123456789",
"type": "INFO",
"message": "System operation completed",
"timestamp": "2024-01-22T15:30:00Z"
},
"message": "Log entry created successfully",
"status": "success"
}
Admin APIs - Logging
Create Log Entry
Create a new log entry
POST
/
logs
/
log
curl -X POST 'https://api.weir.ai/logs/log?scheme=admin' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"type": "INFO",
"message": "System operation completed",
"dateTime": "2024-01-22T15:30:00.000Z"
}'
{
"data": {
"logId": "log_123456789",
"type": "INFO",
"message": "System operation completed",
"timestamp": "2024-01-22T15:30:00Z"
},
"message": "Log entry created successfully",
"status": "success"
}
Create Log Entry
Create a new log entry in the system logging service.curl -X POST 'https://api.weir.ai/logs/log?scheme=admin' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"type": "INFO",
"message": "System operation completed",
"dateTime": "2024-01-22T15:30:00.000Z"
}'
{
"data": {
"logId": "log_123456789",
"type": "INFO",
"message": "System operation completed",
"timestamp": "2024-01-22T15:30:00Z"
},
"message": "Log entry created successfully",
"status": "success"
}
Query Parameters
Request Body
Usage Examples
const createLog = async (logData, scheme, accessToken) => {
const response = await fetch(`https://api.weir.ai/logs/log?scheme=${scheme}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(logData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
import requests
from datetime import datetime
def create_log(log_data, scheme, access_token):
response = requests.post(
f'https://api.weir.ai/logs/log?scheme={scheme}',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
},
json=log_data
)
response.raise_for_status()
return response.json()
# Usage
log_entry = create_log({
'type': 'INFO',
'message': 'System operation completed',
'dateTime': datetime.now().isoformat() + 'Z'
}, 'admin', 'your_access_token')
Was this page helpful?