Skip to main content
POST
https://api-dev.weir.ai/
/
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

scheme
string
required
Log scheme type (admin, console, external).

Request Body

type
string
required
Log type (INFO, WARNING, ERROR, DEBUG).
message
string
required
Log message content.
dateTime
string
required
ISO 8601 formatted timestamp.

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();
};