The RESTful interface of JasperReports Server responds to HTTP requests from client applications, in particular the following methods (sometimes called verbs):
• | GET to list, search and acquire information about repository resources. |
• | POST to create new resources and execute reports. |
• | PUT to modify resources (note that PUT and POST were reversed in the v1 REST API). |
• | DELETE to remove resources. |
In order to introduce new features and keep backwards compatibility, Jaspersoft has introduced a second RESTful API using the rest_v2 URL.
By default, the REST web services are available at the following URLs, where <host> is the name of the computer hosting JasperReports Server and <port> is the port you specified during installation. By default, the context name is jasperserver for the Community Project and jasperserver-pro for commercial editions. The context name may also be customized on your specific installation of JasperReports Server.
Web Service |
URLs |
Login (optional) |
http://<host>:<port>/jasperserver[-pro]/rest/GetEncryptionKey http://<host>:<port>/jasperserver[-pro]/rest/login http://<host>:<port>/jasperserver[-pro]/j_spring_security_check http://<host>:<port>/jasperserver[-pro]/logout.html |
Repository |
http://<host>:<port>/jasperserver[-pro]/rest_v2/resources http://<host>:<port>/jasperserver-pro/rest_v2/domains/.../metadata * http://<host>:<port>/jasperserver[-pro]/rest_v2/permissions http://<host>:<port>/jasperserver[-pro]/rest_v2/export http://<host>:<port>/jasperserver[-pro]/rest_v2/import |
Reports |
http://<host>:<port>/jasperserver[-pro]/rest_v2/reports http://<host>:<port>/jasperserver[-pro]/rest_v2/reportExecutions http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/.../inputControls http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/.../options http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs http://<host>:<port>/jasperserver-pro/rest_v2/queryExecutor * |
Administration |
http://<host>:<port>/jasperserver[-pro]/rest_v2/users http://<host>:<port>/jasperserver[-pro]/rest_v2/users/.../attributes http://<host>:<port>/jasperserver[-pro]/rest_v2/roles http://<host>:<port>/jasperserver[-pro]/rest_v2/attributes |
Administration |
http://<host>:<port>/jasperserver-pro/rest_v2/organizations http://<host>:<port>/jasperserver-pro/rest_v2/organizations/.../attributes http://<host>:<port>/jasperserver-pro/rest_v2/organizations/.../users http://<host>:<port>/jasperserver-pro/rest_v2/organizations/.../users/.../attributes http://<host>:<port>/jasperserver-pro/rest_v2/organizations/.../roles http://<host>:<port>/jasperserver-pro/rest_v2/attributes http://<host>:<port>/jasperserver-pro/rest_v2/serverInfo |
* Available only in commercial editions of JasperReports Server. |
Applications may receive the machine-readable XML description of all supported REST v2 services in Web Application Desciption Language (WADL) at the following URL:
http://<host>:<port>/jasperserver[-pro]/rest_v2/application.wadl
The original REST (now called v1) API is being deprecated. These services are still supported but no longer include the latest features of the server.
Web Service |
URLs |
Repository |
http://<host>:<port>/jasperserver[-pro]/rest/resources http://<host>:<port>/jasperserver[-pro]/rest/resource http://<host>:<port>/jasperserver[-pro]/rest/permission |
Reports |
http://<host>:<port>/jasperserver[-pro]/rest/report http://<host>:<port>/jasperserver[-pro]/rest/jobsummary http://<host>:<port>/jasperserver[-pro]/rest/job |
Administration |
http://<host>:<port>/jasperserver[-pro]/rest/user http://<host>:<port>/jasperserver[-pro]/rest/attribute http://<host>:<port>/jasperserver[-pro]/rest/role |
Administration |
http://<host>:<port>/jasperserver-pro/rest/organization http://<host>:<port>/jasperserver-pro/rest/user http://<host>:<port>/jasperserver-pro/rest/attribute http://<host>:<port>/jasperserver-pro/rest/role |
* Available only in commercial editions of JasperReports Server. |
As with any RESTful service, not all methods (GET, PUT, POST, and DELETE) are supported on every service. The URLs usually include a path to the resource being acted upon, as well as any paramters that are accepted by the method. For example, to search for input control resources in the repository, your application would send the following HTTP request:
GET http://<host>:<port>/jasperserver-pro/rest_v2/resources?type=inputControl
The reference chapters in this book give the full description of the methods supported by each URL, the path or resource expected for each method, and the parameters that are required or optional. The description of each method includes a sample of the return value.
JasperReports Server REST services return standard HTTP status codes. In case of an error, a detailed message may be present in the body in form of plain text. Client error codes are of type 4xx, while server errors are of type 5xx. The following table lists all the standard HTTP codes.
Success Messages |
Client Error |
Server Errors |
|||
Code |
Message |
Code |
Message |
Code |
Message |
100 |
Continue |
400 |
Bad Request |
500 |
Internal Server Error |
101 |
Switching Protocols |
401 |
Unauthorized |
501 |
Not Implemented |
200 |
OK |
402 |
Payment Required |
502 |
Bad Gateway |
201 |
Created |
403 |
Forbidden |
503 |
Service Unavailable |
202 |
Accepted |
404 |
Not Found |
504 |
Gateway Time-out |
203 |
Non-Authoritative Information |
405 |
Method Not Allowed |
505 |
HTTP Version Not Supported |
204 |
No Content |
406 |
Not Acceptable |
|
|
205 |
Reset Content |
407 |
Proxy Authentication Required |
||
206 |
Partial Content |
408 |
Request Time-out |
||
300 |
Multiple Choices |
409 |
Conflict |
||
301 |
Moved Permanently |
410 |
Gone |
||
302 |
Found |
411 |
Length Required |
||
303 |
See Other |
412 |
Precondition Failed |
||
304 |
Not Modified |
413 |
Request Entity Too Large |
||
305 |
Use Proxy |
414 |
Request-URI Too Large |
|
|
307 |
Temporary Redirect |
415 |
Unsupported Media Type |
||
|
416 |
Requested Range Not Satisfiable |
|||
417 |
Expectation Failed |