Update Report Template

Updates the specified report template.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

PUT /api/sonar/report-templates/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d name="Report template" \
     -d description="Report template description" \
     -d group_guid="b5bc3133-b53e-4b61-96b5-8857015a0ede" \
     -d 'sections=[{"type":"PARAGRAPH","title":"Overview","query":"json \"{}\" | eval line=concat(\"The query execution history from\"$(\" from\"), \" to \", $(\"to\")","visible":true,"ordinal":0},{"type":"GRID","title":"Query execution per hour","query":"table from=$(\"from\") to=$(\"to\") araqne_query_logs | search isnotnull(duration) | timechart span=1h count","visible":true,"ordinal":1}]' \
     -X PUT \
     https://HOSTNAME/api/sonar/report-templates/e2fad16d-8076-4c91-9d69-9419c5e6d300
Request Parameters
KeyRequiredTypeDescriptionNote
guidXStringReport template GUID36 characters
nameOStringReport template nameMinimum 1 to maximum 50 characters
descriptionXStringReport template descriptionMaximum 2,000 characters
group_guidXStringParent report group GUID36 characters
sectionsOObject ArrayList of report sectionsSee sections attributes below.

sections attributes

  • type (String): Section type (either paragraph, memo, grid, or chart)
  • title (String): Report item title
  • query (String): Query to return value for the report item
  • visible (Boolean): visibility status
  • ordinal (32-bit integer): Section order

Success Response

{}

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "name should be not null"
}
Invalid argument length

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'name' must be shorter than or equal to 50 characters."
}
Identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
'sections' parameter is not in valid JSON format

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'sections' parameter should follow valid JSON syntax"
}
Invalid section type

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "invalid report section type: ABC"
}
No privilege to update a report template

HTTP status code 500

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