Log endpoints

These are log related endpoints, allowing you to retrieve information related to your log. Your log items are persisted in your log_entries Magic database table.

GET magic/system/log/count

This endpoint counts the total number of log items in your backend, optionally matching the specified [query] filter. The endpoint can only be invoked by a root user. The endpoint handles the following optional query argument(s).

  • [query] - Optional filter log items must match to be counted

This endpoint is not intended for you to consume in your own code.

GET magic/system/log/get

This endpoint returns the specified [id] log item, including its meta data. The endpoint can only be invoked by a root user. The endpoint requires the following query argument(s).

  • [id] - Id of log item to retrieve

This endpoint is not intended for you to consume in your own code.

GET magic/system/log/list

This endpoint returns log items from your backend, and can optionally allow you to page with the following query parameters.

  • [from] - Id of an existing log item from where items will be returned “from”, not including
  • [max] - Maximum number of log items to return
  • [query] - Optional filter log items must match to be returned

This endpoint is not intended for you to consume in your own code.

POST magic/system/log/log-loc

This endpoint allows you to log lines of code generated by either some sort of frontend scaffolding process, or CRUD backend process. The endpoint can only be invoked by a root user, and requires the following payload.

{
  "loc": 42,
  "type": "backend|frontend",
  "name": "Name of module/frontend"
}

The above arguments imply the following.

  • [loc] - Number of lines of code generated
  • [type] - Either backend or frontend
  • [name] - Name of module or frontend that was generated

This endpoint is not intended for you to consume in your own code.

POST magic/system/log/log

This endpoint allows you to log some arbitrary log item, and takes the following payload.

{
  "type": "foo",
  "content": "foo",
  "meta": {
    "foo1": "bar1",
    "foo2": "bar2",
    "foo3": "bar3"
  }
}

The above arguments imply the following.

  • [type] - Type of log entry to create, one of ‘debug’, ‘info’, ‘error’ or ‘fatal’
  • [content] - Content description for your log item
  • [meta] - Key/value pair of additional “meta information” associated with log item

The endpoint can be invoked by any user but requires the user to be authenticated towards the backend and transmit his JWT token in the Authorization HTTP header as a “Bearer” token.

This endpoint is intended for you to consume from your own code.