Get Report Template

Retrieves information of a specified report template.

Required Permissions

Requires the MEMBER role or higher.

HTTP Request

GET /api/sonar/report-templates/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/report-templates/e2fad16d-8076-4c91-9d69-9419c5e6d300
Request Parameter
KeyRequiredTypeDescriptionNote
guidOStringReport template GUID36 characters

Success Response

{
  "template": {
    "guid": "e2fad16d-8076-4c91-9d69-9419c5e6d300",
    "name": "Report template",
    "description": "Report template description",
    "group_guid": "eaf5e265-a186-4029-9264-dade868559ba",
    "group_name": "Report group",
    "owner_guid": "ce23adf2-13e4-40f9-ad0c-74d090b1f10c",
    "owner_name": "Demo",
    "sections": [
      {
        "type": "paragraph",
        "title": "Overview",
        "query": "json \"{}\" | eval line=concat(\"The query execution history from\"$(\" from\"), \" to \", $(\"to\")",
        "visible": true,
        "ordinal": 0,
        "created": "2024-08-13 09:53:39+0900",
        "updated": "2024-08-13 09:53:39+0900"
      },
      {
        "type": "grid",
        "title": "Queries per hour",
        "query": "table from=$(\"from\") to=$(\"to\") araqne_query_logs | search isnotnull(duration) | timechart span=1h count",
        "visible": true,
        "ordinal": 1,
        "created": "2024-08-13 09:53:39+0900",
        "updated": "2024-08-13 09:53:39+0900"
      },
      {
        "type": "vbar",
        "title": "Queries per hour chart",
        "options": {
          "log_scale": true,
          "percentage": false,
          "label": true
        },
        "query": "table from=$(\"from\") to=$(\"to\") araqne_query_logs | search isnotnull(duration) | timechart span=1h count",
        "visible": true,
        "ordinal": 2,
        "created": "2024-08-13 09:53:39+0900",
        "updated": "2024-08-13 09:53:39+0900"
      }
    ],
    "created": "2024-08-08 10:27:42+0900",
    "updated": "2024-08-13 09:53:39+0900"
  }
}
  • template (Map): Report template
    • guid (String): Report template GUID
    • name (String): Report template name
    • description (String): Report template description
    • group_guid (String): Report group GUID
    • group_name (String): Report group name
    • owner_guid (String): Owner GUID
    • owner_name (String): Owner name
    • sections (Object array): Report template sections
      • type (String): Section type (paragraph, memo, grid, hbar, hbar_stck, vbar, vbar_stck, line, area_stacked, pie)
      • title (String): Report item title
      • options (Map, optional): Section options (only included for chart types when options are set)
        • log_scale (boolean): Apply logarithmic scale (hbar, hbar_stck, vbar, vbar_stck, line, area_stacked only)
        • percentage (boolean): Apply percentage scale (hbar, hbar_stck, vbar, vbar_stck, line, area_stacked only)
        • pie_donut (boolean): Display pie chart as donut (pie only)
        • label (boolean): Display labels (hbar, hbar_stck, vbar, vbar_stck, pie only)
      • query (String): Query to return value for the report item
      • visible (boolean): Visibility status
      • ordinal (32-bit integer): Section order
      • created (String): Creation date and time (yyyy-MM-dd HH:mm:ssZ)
      • updated (String): Last modification date and time (yyyy-MM-dd HH:mm:ssZ)
    • created (String): Creation date and time (yyyy-MM-dd HH:mm:ssZ)
    • updated (String): Last modification date and time (yyyy-MM-dd HH:mm:ssZ)

Error Responses

Report template is not found

HTTP status code 200

{
  "template": null
}
Identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
No privilege to get a report template

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}