In addition to running reports, JasperReports Server exposes queries that you can run through the rest_v2/queryExecutor service. In release 5.1, the only resource that supports queries is a Domain.
Method | URL | ||
GET | http://<host>:<port>/jasperserver-pro/rest_v2/queryExecutor/path/to/Domain/?q=<query> | ||
Argument | Type/Value | Description | |
q | Required String | The query string is a special format that references the fields and measures exposed by the Domain. To write this query, you must have knowledge of the Domain schema that is not available through the REST services. See below. | |
Options | |||
accept: application/xml (default) accept: application/json Accept-Language: <locale>, <relativeQualityFactor>; for example en_US, q=0.8; | |||
Return Value on Success | Typical Return Values on Failure | ||
200 OK – The body contains the data that is the result of the query. See the format of the data below. | 404 Not Found – When the specified Domain does not exist. |
If the query is too large to fit in the argument in the URL, use the POST method to send it as request content:
Method | URL | ||
POST | http://<host>:<port>/jasperserver-pro/rest_v2/queryExecutor/path/to/Domain/ | ||
Content-Type | Content | ||
application/xml | The query string is a special format that references the fields and measures exposed by the Domain. To write this query, you must have knowledge of the Domain schema that is not available through the REST services. See below. | ||
Options | |||
accept: application/xml (default) accept: application/json Accept-Language: <locale>, <relativeQualityFactor>; for example en_US, q=0.8; | |||
Return Value on Success | Typical Return Values on Failure | ||
200 OK – The body contains the data that is the result of the query. See the format of the data below. | 404 Not Found – When the specified Domain does not exist. |
The following example show the format of a query in XML:
And the following sample shows the result of query. In order to optimize the size of the response, rows are presented as sets of values without the column names repeated for each row. The column IDs appear at the top of the result, as shown in the following example. As with the query, the result requires knowledge of the Domain schema to identify the human-readable column names.
Both date-only and timestamp fields are given in the ISO date-time format such as 1997-01-01T04:05:06+02:00. For database columns that store a time and date that includes a time zone, such as “timestamp with time zone” in PostgreSQL, the result is not guaranteed to be in the same timezone as stored in the database. These dates and times are converted to the server’s time zone. |
Recommended Comments
There are no comments to display.