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*"): 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, for example

+title,-id sorts 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 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

<<JSON of the report template>>
Response
// POST /resources/reports
// Content-Type: application/json
//
// {
// 		"id": "atest",
// 		"enabled": true,
// 		"title": "asdf",
// 		"description": ""
// }

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

------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}
Response
// GET /resources/reports/atest

{
    "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

<<JSON of the report template>>
Response
// PUT /resources/reports/atest
// Content-Type: application/json
//
// {
// 		"id": "atest",
// 		"enabled": false,
// 		"title": "Test",
// 		"description": "My Description"
// }

{
    "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}
Response
// DELETE /resources/reports/atest

204 No Content

Generate a report

Request
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.

The response depends on the parameters, for example if a PDF file is generated.

Request example
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. You can generate other report formats by configuration.

additional report specific parameters

Any additional parameter appended to the URL is directly passed to 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 passed as REPORT_LOCALE to the report engine. It depends on the report definition if this value is respected.