Reporting Service: REST Interface

The base URL of the report service endpoint is http://<server>:<port>/<contextname>/resources/reports.

Query report templates

Request
-------
GET /resources/reports?filter=enabled%3Dtrue&range=0-1&sort=+id

Response
--------
{
	"total": 4,
	"items": [{
		"id": "atest",
		"enabled": true,
		"uploaded": true,
		"title": "asdf",
		"description": "",
		"createdBy": "admin",
		"createdAt": 1385381944090,
		"modifiedBy": "admin",
		"modifiedAt": 1410850250188,
		"fileName": "default.zip"
	},
	{
		"id": "s_default",
		"enabled": true,
		"uploaded": false,
		"title": "default",
		"description": "",
		"createdBy": "",
		"createdAt": 1410925051849,
		"modifiedBy": "admin",
		"modifiedAt": 1410924618000,
		"fileName": "report.jrxml"
	}]
}
Query Parameter
Name Default Description

filter

A filter query expression that allows to search for reports with special properties.

Simple Query:

<property>=<value>, for example enabled=true or title="test"

Simple Queries can be combined using and,or,not operators like:

(and enabled=true;title like "d*") which means: return enabled report templates with a title starting with the character "d".

sort

+title

A comma separated list of property names prefixed by '+' or '-', which defines the sort order of the response, e.g:

+title,-id means sort based on the title property (ascending) and remaining equal items after the id (descending).

range

0-

This is a range expression to allow paging through the result list.

The formal definition of the range expression is: <startindex>-<endindex>.

0- = return all results

0-0 = return the first item

0-1 = return the first two items of the result set

10-12 = return the 10th,11th,12th item

0—​1 = return nothing (only return the count)

Create a report template

Request
-------
POST /resources/reports
Content-Type: application/json
Body: the json of the report template.

for example
POST /resources/reports
Content-Type: application/json
Body:
{
		"id": "atest",
		"enabled": true,
		"title": "asdf",
		"description": ""
}

Response
--------
303 See Other
Location: http://localhost:8080/resources/reports/atest

Upload a report template

Request
-------
POST /resources/reports/{id}
Content-Type: multipart/form-data; boundary=----BOUNDARY
Body:
------BOUNDARY
Content-Disposition: form-data; name="file"; filename="default.zip"
Content-Type: application/x-zip-compressed
BINARY DATA HERE

------BOUNDARY--


Response
--------
{"file":"default.zip","name":"default.zip","type":".zip"}

Get a report template

Request
-------
GET /resources/reports/{id}

for example
GET /resources/reports/atest

Response
--------
{
		"id": "atest",
		"enabled": true,
		"uploaded": true,
		"title": "asdf",
		"description": "",
		"createdBy": "admin",
		"createdAt": 1385381944090,
		"modifiedBy": "admin",
		"modifiedAt": 1410850250188,
		"fileName": "default.zip"
}

Change a report template

Request
-------
PUT /resources/reports/{id}
Content-Type: application/json
Body: the json of the report template.

for example
GET /resources/reports/atest
Content-Type: application/json
Body:
{
		"id": "atest",
		"enabled": false,
		"title": "Test",
		"description": "My Description"
}

Response
--------
{
		"id": "atest",
		"enabled": false,
		"uploaded": true,
		"title": "Test",
		"description": "My Description"
		"createdBy": "admin",
		"createdAt": 1385381944090,
		"modifiedBy": "admin",
		"modifiedAt": 1410850250188,
		"fileName": "default.zip"
}

Delete a report template

Request
-------
DELETE /resources/reports/{id}

for example
DELETE /resources/reports/atest

Response
--------
204 No Content

Generate a report

GET|POST /resources/reports/{id}/generate{filename}?download=<true|false>&f=<format>&<additional report specific parameters>

If POST is used, the query parameters must be provided as URL form encoded in the body of the request.

Response depends on the parameters for example a pdf file is generated.


Sample:

GET /resources/reports/atest/generateReport.pdf?download=false&f=pdf&ids=0&dsurl=http://sampleserver/arcgis/rest/services/TestFeatures/FeatureServer/0
Query Parameter
Name Default Description

filename

A special part of the URL which is used to encode the filename shown in the download dialog. This is only relevant if the option download is true.

download

false

Defines that a "Content-Disposition" header should be returned. This indicates to the browser that the response should be downloaded and not interpreted.

f

pdf

Defines the format of the generated report. It is possible to generate other report formats by configuration.

additional report specific parameters

Any additional parameter appended to the URL is directly transferred into the report generation process as parameter.

Well known parameters of the default report template
Name Description

ids

A comma separated list of feature IDs. It is provided as "FEATURE_IDS" parameter to the generation process.

dsurl

The data source URL. It contains the features specified by the ids parameter. It is provided as "FEATURE_DS" parameter to the generation process.

lang

The language to use in the report. It is transported as REPORT_LOCALE into the report engine. If the value is respected depends on the report.