Jump to content
We've recently updated our Privacy Statement, available here ×
  • This documentation is an older version of JasperReports Server REST API Reference. View the latest documentation.

    The reports service includes methods for reading and setting input controls. The rest_v2/reports/inputControls methods return an XML descriptor by default, but you can optionally specify the JSON format. The examples in this section use the JSON format.

    This chapter includes the following sections:

    Listing Input Control Structure
    Listing Input Control Values
    Setting Input Control Values

    Listing Input Control Structure

    The following method returns a description of the structure of the input controls for a given report.

    Method

    URL

    GET

    http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/inputControls/

    Options

    accept: application/json

    Return Value on Success

    Typical Return Values on Failure

    200 OK – The content is a JSON object that describes the input control structure. See example below.

    404 Not Found – When the specified report URI is not found in the repository.

    The body of the response contains the structure of the input controls for the report. This structure contains the information needed by your application to display the input controls to your users and allow them to make a selection. In particular, this includes any cascading structure as a set of dependencies between input controls. Each input control also has a type that indicates how the user should be allowed to make a choice:

    bool

    singleSelect

    singleSelectRadio

    multiSelectCheckbox

    multiSelect

    singleValue

    singleValueText

    singleValueNumber

    singleValueDate

    singleValueDatetime

    singleValueTime

    The following example shows a response in the JSON format:

    The structure includes a set of validation rules for each input control. These rules indicate what type of validation your client should perform on input control values it receives from your users, and if the validation fails, the message to display. Depending on the type of the input control, the following validations are possible:

    mandatoryValidationRule – This input is required and your client should ensure the user enters a value.
    dateTimeFormatValidation – This input must have a data time format and your client should ensure the user enters a valid date and time.

    The following sample shows the structure of these two possible validation rules.

    Listing Input Control Values

    The following method returns a description of the possible values of all input controls for the report. Among these choices, it shows which ones are selected.

    Method

    URL

    GET

    http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/inputControls/values/

    Options

    accept: application/json

    Return Value on Success

    Typical Return Values on Failure

    200 OK – The content is a JSON object that describes the input control values and selection.

    404 Not Found – When the specified report URI is not found in the repository.

    The body of the response contains the structure of the input controls for the report. The following example shows a response in the JSON format:

    note-icon-ns_28x28.png.eb172702e6e20bcfd8b5a653b4f57eae.png

    If a selection-type input control has a null value, it is given as ~NULL~. If no selection is made, its value is given as ~NOTHING~.

    Setting Input Control Values

    The following method validates the input controls that you send, to ensure that they can be used in the next run of the report.

    Method

    URL

    POST

    http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report/inputControls/<ic1>;
    <ic2>;.../values/

    Content-Type

    Content

    application/json

    A JSON object that lists your selected values. The value of every input control is given as an array of string values, even for single-select controls or multi-select controls with a single value. See also the 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.

    Assuming the client receives the response given in Listing Input Control Values, it can send the following request body:

    When specifying the option for the JSON format, the server’s response is:


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...