Manage application reports

Use the reporting service to manage your scope’s OpenSearch Dashboards reports

The ReportingService outlines the various operations you can perform on OpenSearch Dashboards reports.

  • getAll: retrieves all reports for the current scope.

  • create: creates a list of reports. The list of reports to be added must be supplied as input, and these will then be created in the application.

  • get: retrieves reports from the list of report IDs.

  • update: updates a list of reports by report ID. The new version of these reports must be supplied as input.

  • delete: deletes reports by ID.

Report retrieval

The following examples show how to recover OpenSearch Dashboards reports using different recovery operations.


Retrieve all reports :


GET {{core}}/rest/report/ HTTP/1.1

-- Paramètres d'URL --
core: host of FlowerDocs core

-- Headers --
token: {{token}}
Content-Type: application/json

@Autowired
private ReportingService service;

public List<Report> getAllReports() throws TechnicalException, FunctionalException
{
    return service.getAll();
}

Report retrieval by ID :


GET {{core}}/rest/report/{ids} HTTP/1.1

-- URL parameters
core: host of FlowerDocs core
ids: identifiers of the reports to be retrieved

-- Headers 
token: {{token}}
Content-Type: application/json

@Autowired
private ReportingService service;

public List<Report> get() throws TechnicalException, FunctionalException
{
    return service.get(Lists.newArrayList(new Id("reportId")));
}

Report creation

The examples below show how to create reports using the following operation.

Creating reports :


POST {{core}}/rest/report HTTP/1.1

-- Paramètres d'URL --
core: host of FlowerDocs core

--Headers --
token: {{token}}
Content-Type: application/json
 
-- Body (json) --
[
  {
    "ACL": "ACL_Report",
    "displayNames": [
      {
        "language": "FR",
        "value": "nouveau rapport"
      },
      {
        "language": "EN",
        "value": "new report"
      }
    ],
    "id": "reportId",
    "name": "newReport",
    "url": "url"
  }
]

@Autowired
private ReportingService service;

public List<Report> create() throws FunctionalException, TechnicalException
{
    Report report = new Report(new Id("reportId"),
        Lists.newArrayList(new I18NLabel("nouveau rapport", "FR"), new I18NLabel("new report", "EN")),
        new Id("ACL_Report"), "newReport", "url");
    List<Report> reports = Lists.newArrayList(report);
    return service.create(reports);
}

Report modification

The examples below show how to update reports using the operation ofupdate.

Update reports by ID :


PUT {{core}}/rest/report/{ids} HTTP/1.1

-- Paramètres d'URL --
core: host of FlowerDocs core
ids: identifiers of reports to be modified

-- Headers --
token: {{token}}
Content-Type: application/json

-- Body (json) --
[
  {
    "ACL": "ACL_Report",
    "displayNames": [
      {
        "language": "FR",
        "value": "updated report"
      },
      {
        "language": "EN",
        "value": "updated report"
      }
    ],
    "id": "reportId",
    "name": "updatedReport",
    "url": "url"
  }
]

@Autowired
private ReportingService service;

public List<Report> update() throws FunctionalException, TechnicalException
{
    Report report = new Report(new Id("reportId"),
        Lists.newArrayList(new I18NLabel("rapport mis à jour", "FR"), new I18NLabel("updated report", "EN")),
        new Id("ACL_Report"), "updatedReport", "url");
    List<Report> reports = Lists.newArrayList(report);
    return service.update(reports);
}