Create a saved report

Use Rest API to create a saved report across Compliance instances.

Use the POST operation on the api/reports element to create a saved report.

Table 1. Operation details

Operation details Description
Operation POST/api/reports
Purpose Create a saved report item.
HTTP method POST
Request content type Application/json
Normal HTTP response codes 200 OK + JSON data for single saved report definition that is created by POST

Error response codes

The following list includes the operation details for error response codes.

500 + "Error: Name is already taken"
When a duplicate post is made. The report is unique by name, user, and report category.
500 + "Error: The property '#/' did not contain a required property of 'name' in schema f967028a-a442-59a2-ac38-8b596bcf8d2a#"}"
When the header is missing content-type: application/json.
401 Unauthorized + {"error":"There is no match for the provided user name and password"}
When no token is provided.
404 Not found
When using unnecessary ID (POST/api/reports/<id>
500 Internal Server Error ('Sorry something went wrong...') + error in the TEMA log
When the JSON format is invalid.
401 Unauthorized + {"error":"You are not assigned a Computer Group. You will not be able to access the system until you are assigned a valid Computer Group. Contact your administrator for assistance."}
When the token for the user has no computer assigned.
404 + {"error":"Sequel::RecordNotFound"}
When the ID is invalid.
404 + {"error":"Sequel::RecordNotFound"}
When accessing the private report of another user.
500 + {"error":"There was a problem with your request."}500 + {"error":"The property '#/path' value \"aaa\" did not match the regex '^(/[^/]+)+$' in schema f967028a-a442-59a2-ac38-8b596bcf8d2a#"}
When specifying path parameters that do not exist, such as /scm/test, aaa, and others.
500 + {"error":"The property '#/state/column_order/id' of type String did not match the following type: integer in schema afc10b8d-2caf-50e7-a82e-a083dc10ee61#"}
When there is a parameter type mismatch such as previously specifying a string for an integer. You must delete then recreate the saved report with API, or save the report again from the UI.
"criteria":{ "and":["aaa","bbb"] } 500 + {"error":"Argument must be a Hash, Array, or Criterion"}
When the criteria specification is invalid.
Note: When an invalid column is selected, such as columns from a different report, the created saved report returns the default columns but without any data, or the specified column name is saved but ignored.