This chapter describes the rest_v2/reports/options service. Report options are sets of input control values that are saved in the repository. A report option is always associated with a report.
This chapter includes the following sections:
• | Listing Report Options |
• | Creating Report Options |
• | Updating Report Options |
• | Deleting Report Options |
Listing Report Options
The following method retrieves a list of report options summaries. The summaries give the name of the report options, but not the input control values that are associated with it.
Method | URL | ||
GET | http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/options/ | ||
Options | |||
accept: application/json | |||
Return Value on Success | Typical Return Values on Failure | ||
200 OK – The content is a JSON object that lists the names of the report options for the given report. | 404 Not Found – When the specified report URI is not found in the repository. |
The body of the response contains the labels of the report options, for example:
Creating Report Options
The following method creates a new report option for a given report. A report option is defined by a set of values for all of the report’s input controls.
Method | URL | ||
POST | http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/options?<arguments> | ||
Argument | Type/Value | Description | |
label | string | The name to give the new report option. | |
overwrite? | true / false | If true, any report option that has the same label is replaced. If false or omitted, any report option with the same label will not be replaced. | |
Content-Type | Content | ||
application/json | A JSON object that lists the input control selections. See example below. | ||
Options | |||
accept: application/json | |||
Return Value on Success | Typical Return Values on Failure | ||
200 OK – The content is a JSON object that describes the new selection of input control values. | 404 Not Found – When the specified report URI is not found in the repository. |
In this example, we create new options for the sample report named Cascading_multi_select_report:
http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/Cascading_multi_select_report/options?label=MyReportOption
With the following request body:
When successful, the server responds with a JSON object that describes the new report options, for example:
Updating Report Options
Use the following method to modify the values in a given report option.
Method | URL | ||
PUT | http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/options/<optionID>/ | ||
Content-Type | Content | ||
application/json | A JSON object that lists the input control selections. See example below. | ||
Return Value on Success | Typical Return Values on Failure | ||
200 OK | 404 Not Found – When the specified report URI is not found in the repository. |
For example, we change the report option we created in Creating Report Options with the following header:
http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/Cascading_multi_select_report/options/MyReportOption
And the following request body:
Deleting Report Options
Use the following method to delete a given report option.
Method | URL | ||
DELETE | http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/options/<optionID>/ | ||
Return Value on Success | Typical Return Values on Failure | ||
200 OK | 404 Not Found – When the specified report URI is not found in the repository. |
Recommended Comments
There are no comments to display.