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:

{
"inputControl" : [ {
  "id":"Cascading_name_single_select",
  "label":"Cascading name single select",
  "mandatory":"true",
  "readOnly":"false",
  "type":"singleSelect",
  "uri":"repo:/reports/samples/Cascading_multi_select_report_files/Cascading_name_single_select",
  "visible":"true",
  "masterDependencies":{"controlId":["Country_multi_select","Cascading_state_multi_
                        select"]},
  "slaveDependencies":null,
  "validationRules": [{ ... }]
    "state": {
    "uri": "/reports/samples/Cascading_multi_select_report_files/
            Cascading_name_single_select",
    "id": "Cascading_name_single_select",
    "value": null,
    "options": [{
      "selected": false,
      "label": "A & U Jaramillo Telecommunications, Inc",
      "value": "A & U Jaramillo Telecommunications, Inc"
      },      ...      ]}               }
  },
  ...
]}

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.

  "validationRules": [{
    "mandatoryValidationRule" : {
      "errorMessage" : "This field is mandatory so you must enter data."
    },
    "dateTimeFormatValidationRule" : {
      "errorMessage" : "Specify a valid date value.",
      "format" : "yyyy-MM-dd"
    }
  }]
Feedback