Chapter 11. REST API

11. REST API

ReportServer publishes several REST API endpoints automatically which can be used for accessing given REST services.

11.1. Finding the REST URL

You can find the main REST endpoint of your ReportServer in the ''General Info'' system console. Here, you can find a ''REST URL'' entry which displays the complete URL to your REST endpoint. An example is given below.

REST URL: https://SERVER:PORT/reportserverbasedir/reportserver/rest

Having this base URL it is easy to append the services described below to access the specific REST services available.

Note that spaces in URLs will be encoded as

11.2. Authentication

REST API authentication uses an apikey analogously as in executing reports via URL (see Section 7.11.). Once you set an apikey for a given user, you can access all REST services using this apikey in the URL, e.g. for the ''general-info'' REST service:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/general-info?user=myuser&apikey=MYAPIKEY

In the example above, the user authenticated is myuser and the apikey is MYAPIKEY.

Note that the apikey can be found as plain text in the URL, so make sure you use HTTPS. Treat the apikey like any password.
11.3. test Service

The test REST service issues a test request which allows you to make sure the REST endpoint is correct and available.

The syntax is:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/test?user=myuser&apikey=MYAPIKEY

11.4. general-info Service

The general-info REST service returns a JSON containing your system configuration. Basically, it contains all data available in the ''General Info'' system console.

The syntax is:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/general-info?user=myuser&apikey=MYAPIKEY

11.5. dot-renderer Service

The dot-renderer REST service allows you to render a Graphviz DOT file (https://graphviz.org/doc/info/lang.html) into a SVG file which can be displayed directly by your web browser.

The syntax is:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/dot-renderer?path=/fileserver/resources/graph.dot&user=myuser&apikey=MYAPIKEY

where the path argument points to the DOT file in your ReportServer virtual filesystem, in this case to /fileserver/resources/graph.dot.

An optional width parameter may be used to change the SVG file's width. Default is 1200.

https://SERVER:PORT/reportserverbasedir/reportserver/rest/dot-renderer?path=/fileserver/resources/graph.dot&width=900&user=myuser&apikey=MYAPIKEY

11.6. node-exporter Service

The node-exporter REST service allows you to export any node to XML in an analogous way as the ''export'' functionality described in Section 10. Along with the XML export, some metadata is displayed in the JSON file.

The syntax is dependent on the specific node being exported and will be described in the following subsections.

You can always use the terminal for finding out the exact path of the node you want to export. Just navigate to the node you to export and enter the pwd command as described in Section 19.49.

11.6.1. Exporting reports

The node-exporter service can be used to export reports or report directories using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/reportmanager/myreports/myreport?user=myuser&apikey=MYAPIKEY

where /reportmanager/myreports/myreport is a path to the report being exported. You can also export a complete report directory, e.g. /reportmanager/myreports.

An optional includeVariants parameter is used to export variants along with the base reports. Default is false:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/reportmanager/myreports/myreport?includeVariants=true&user=myuser&apikey=MYAPIKEY

11.6.2. Exporting users

The node-exporter service can be used to export users, groups or organizational units using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/usermanager/ClassicModelCars/myuser?user=myuser&apikey=MYAPIKEY

where /usermanager/ClassicModelCars/myuser is a path to the user or group being exported. You can also export a complete organizational unit, e.g. /usermanager/ClassicModelCars.

11.6.3. Exporting datasources

The node-exporter service can be used to export datasources or datasource directories using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/datasources/internal\%20datasources/ReportServer\%20Data\%20Source?user=myuser&apikey=MYAPIKEY

where /datasources/internal datasources/ReportServer Data Source is a path to the datasource being exported. You can also export a complete directory, e.g. /datasources/internal datasources.

11.6.4. Exporting datasinks

The node-exporter service can be used to export datasink or datasink directories using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/datasinks/mydirectory/mydatasink?user=myuser&apikey=MYAPIKEY

where /datasinks/mydirectory/mydatasink is a path to the datasink being exported. You can also export a complete directory, e.g. /datasinks/mydirectory.

11.6.5. Exporting files

The node-exporter service can be used to export files or file directories from the virtual file system using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/fileserver/mydirectory/myfile.groovy?user=myuser&apikey=MYAPIKEY

where /fileserver/mydirectory/myfile.groovy is a path to the file being exported. You can also export a complete directory, e.g. /fileserver/mydirectory.

11.6.6. Exporting remote servers

The node-exporter service can be used to export remote servers or remote server directories using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/remoteservers/mydirectory/myremoteserver?user=myuser&apikey=MYAPIKEY

where /remoteservers/mydirectory/myremoteserver is a path to the remote server being exported. You can also export a complete directory, e.g. /remoteservers/mydirectory.

11.6.7. Exporting dashboards from dashboard library

The node-exporter service can be used to export dashboards or dashboard library directories using the following syntax:

https://SERVER:PORT/reportserverbasedir/reportserver/rest/node-exporter/dashboardlib/mydirectory/Demo Dashboard?user=myuser&apikey=MYAPIKEY

where /dashboardlib/mydirectory/Demo Dashboard is a path to the dashboard being exported. You can also export a complete directory, e.g. /dashboardlib/mydirectory.