reportserver-401403-configuration-and-api-http-api.md
The Report and Dashboard Server exposes an HTTP API that you can use to communicate with the server from your application’s code. This document describes how to use this HTTP API in an application and lists the available API endpoints.
To use the Report and Dashboard Server’s HTTP API, you first need to obtain an authentication token that you should then attach to all API requests. To obtain the token, do the following:
Configure the Report and Dashboard Server to use the HTTPS protocol.
Create a user account with Server authentication and give this account the required permissions.
Send the following POST request to the server to obtain a Bearer token required to access the Report and Dashboard Server’s API:
$ curl -d "grant_type=password&username=your_username&password=your_password" https://localhost/oauth/token
{"access_token":<oauth-token>, "token_type":"bearer","expires_in":1199}
Starting with the version 19.1.5, you can use the guest account with a blank password to obtain a token.
To attach the obtained token to an API request, add the following HTTP header to the request:
Authorization : Bearer <oauth-token>
Use the following API requests to export a report to PDF and download the resulting document:
Initiate an export task:
Check the export task’s status:
Download the exported document:
Use these API endpoints to manage document categories.
post /api/categories
{
"optimisticLock": "integer",
"name": "string"
}
delete /api/categories
id: integer (query)
get /api/categories/{id}
id: integer (path)
get /api/categories
put /api/categories
{
"optimisticLock": "integer",
"name": "string"
}
Use these API endpoints to configure data models.
post /api/datamodels/{id}/customsqlquery
{
"optimisticLock": "integer",
"name": "string",
"query": "string",
"parameters": [
{
"name": "string",
"type": "string",
"value": "string",
"isNull": "boolean"
}
]
}
id: integer (path)
post /api/datamodels/
{
"name": "string",
"description": "string",
"commandTimeout": "integer",
"providerModel": {
"providerType": "string",
<provider-specific options>
}
}
The ProviderModel option specifies the provider type and provider-specific options:
"authenticationType": "string", // "windows" | "sqlServer"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"authenticationType": "string", // "windows" | "sqlServer"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"jsonDataSource": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"cube": "string",
"additionalParameters": "string"
In addition to the data providers listed above, you can use any database system that supports XPO:
These data providers do not have provider-specific options. Use the providerModel.connectionString option to specify connection settings. For more information on the supported data providers, refer to Database Systems Supported by XPO.
delete /api/datamodels/{id}
id: integer (path)
get /api/datamodels
get /api/datamodels/{id}/connection
id: integer (path)
get /api/datamodels/{id}/customsqlquery/{name}
id: integer (path)
name: string (path)
get /api/datamodels/{id}/datamembers
id: integer (path)
get /api/datamodels/{id}/procedures/{procedureName}/columns
id: integer (path)
procedureName: string (path)
get /api/datamodels/{id}/queries
id: integer (path)
get /api/datamodels/{id}/procedures
id: integer (path)
get /api/datamodels/{id}/tables/{tableName}/columns
id: integer (path)
tableName: string (path)
get /api/datamodels/{id}/tables
id: integer (path)
put /api/datamodels/{id}/tables
{
"optimisticLock": "integer",
"tables": [
{
"optimisticLock": "integer",
"name": "string",
"nonEscapedName": "string",
"checked": "boolean",
"columns": [
{
"name": "string",
"checked": "boolean"
}
]
}
]
}
id: integer (path)
put /api/datamodels/{id}
{
"optimisticLock": "integer",
"name": "string",
"description": "string",
"commandTimeout": "integer",
"providerModel": {
"providerType": "string",
<provider-specific options>
}
}
id: integer (path)
The ProviderModel option specifies the provider type and provider-specific options:
"authenticationType": "string", // "windows" | "sqlServer"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"authenticationType": "string", // "windows" | "sqlServer"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"port": "integer",
"additionalParameters": "string"
"jsonDataSource": "string"
"serverName": "string",
"userName": "string",
"password": "string",
"database": "string",
"cube": "string",
"additionalParameters": "string"
In addition to the data providers listed above, you can use any database system that supports XPO:
These data providers do not have provider-specific options. Use the providerModel.connectionString option to specify connection settings. For more information on the supported data providers, refer to Database Systems Supported by XPO.
put /api/datamodels/{id}/rename
{
"optimisticLock": "integer",
"name": "string"
}
id: integer (path)
put /api/datamodels/{id}/customsqlquery/{name}
{
"optimisticLock": "integer",
"name": "string",
"query": "string",
"parameters": [
{
"name": "string",
"type": "string",
"value": "string",
"isNull": "boolean"
}
]
}
id: integer (path)
name: string (path)
Use these API endpoints to manage dashboards, reports and report documents.
post /api/documents
{
"categoryId": "integer",
"name": "string",
"description": "string",
"revisionComment": "string",
"documentType": "string",
"autoRefreshInterval": "integer",
"layout": "string"
}
The DocumentType option accepts the following values:
delete /api/documents
get /api/documents/export/result/{exportId}
exportId: string (path)
post /api/documents/export/dashboard/{documentId}
{
"exportOptions": {
"exportFormat": "string",
"exportParameters": "boolean"
<format-specific options>
},
"documentParameters": [
{
"name": "string"
}
]
}
documentId: integer (path)
The ExportFormat option accepts the following values:
Depending on the export format, you can provide the following format-specific export options:
"format": "string", // "png" | "jpeg" | "gif"
"resolution": "integer",
"paperKind": "string", // One of System.Drawing.Printing.PaperKind enumeration values
"pageLayout ": "string", // "portrait" | "landscape"
The Export Dashboard task returns the resulting document or an error.
post /api/documents/export/report/{documentId}
{
"exportOptions": {
"exportFormat": "string",
<format-specific options>
},
"documentParameters": [
{
"Name": "string"
}
]
}
documentId: integer (path)
The exportFormat option accepts the following values:
Depending on the export format, you can provide the following format-specific export options:
"exportMode": "string", // "singleFile" | "singleFilePageByPage"
"tableLayout": "boolean",
"keepRowHeight": "boolean"
"exportMode": "string", // "singleFile" | "singleFilePageByPage" | "differentFiles"
"title": "string",
"tableLayout": "boolean"
"convertImagesToJpeg": "boolean"
"enumTextExportMode": "string" // "Value" | "Text"
The Export Report task returns the export task identifier (exportId).
get /api/documents/{id}/jobresults
id: integer (path)
get /api/documents/{id}
id: integer (path)
get /api/documents
get /api/documents/export/status/{exportId}
exportId: string (path)
get /api/documents/{id}/layout
id: integer
get /api/documents/{id}/revisionLayout/{revisionId}
id: integer (path)
revisionId: integer (path)
get /api/documents/{id}/revisions
id: integer (path)
put /api/documents/{id}/save
{
"optimisticLock": "integer",
"autoRefreshInterval": "integer",
"revisionComment": "string",
"layout": "string"
}
id: integer (path)
put /api/documents
{
"optimisticLock": "integer",
"categoryId": "integer",
"name": "string",
"description": "string"
}
Use these API endpoints to manage document generation jobs.
post /api/jobs
{
"optimisticLock": "integer",
"name": "string",
"mode": "string",
"documentId": "integer",
"retentionPeriod": "integer",
"enabled": "boolean",
"startDate": "string",
"timeZone": "string",
"recurrenceRule": "string",
"parameters": [
{
"name": "string",
"source": "string",
"value": any
}
],
"billingStatementBinding": {
"dataModelId": "integer",
"dataMember": "string",
"emailAddressField": "string",
"emailRecipientField": "string"
},
"emailDeliveryFormat": "string",
"sendIndividualEmails": "boolean",
"sendBlankDocument": "boolean",
"subscribedEmails": [
"string"
],
"sharedFolders": [
"string"
],
"internalSubscriberIds": [
"integer"
]
}
The following options require only allowed values:
| Option Name | Allowed Values |
|---|---|
| mode | “document”, “billingStatement” |
| parameters. source | “static”, “calculated”, “bound” |
| emailDeliveryFormat | “url”, “pdf”, “excel”, “html” |
| timeZone | the IANA Time Zone Database time zone identifier |
delete /api/jobs/
id: integer (query)
post /api/jobs/{id}/execute
id: integer (query)
get /api/jobs/{id}/jobresults
id: integer (path)
startDate: string (query)
endDate: string (query)
/api/jobs/generateddocuments/{generatedDocumentId}/export
generatedDocumentId: string (path)
get /api/jobs/{id}
id: integer (path)
get /api/jobs
put /api/jobs
{
"optimisticLock": "integer",
"name": "string",
"mode": "string",
"documentId": "integer",
"retentionPeriod": "integer",
"enabled": "boolean",
"startDate": "string",
"timeZone": "string",
"recurrenceRule": "string",
"parameters": [
{
"name": "string",
"source": "string",
"value": any
}
],
"billingStatementBinding": {
"dataModelId": "integer",
"dataMember": "string",
"emailAddressField": "string",
"emailRecipientField": "string"
},
"emailDeliveryFormat": "string",
"sendIndividualEmails": "boolean",
"sendBlankDocument": "boolean",
"subscribedEmails": [
"string"
],
"sharedFolders": [
"string"
],
"internalSubscriberIds": [
"integer"
]
}
id: integer (query)
The following options require enumeration values:
| Option Name | Allowed Values |
|---|---|
| mode | “document”, “billingStatement” |
| parameters. source | “static”, “calculated”, “bound” |
| emailDeliveryFormat | “url”, “pdf”, “excel”, “html” |
| timeZone | the IANA Time Zone Database time zone identifier |
Use these API endpoints to manage users, user groups and their permissions.
post /api/usergroups
{
"name": "string"
}
post /api/usergroups/{id}/permissions
{
"optimisticLock": "integer",
"permissions": [
{
"accessMode": "integer",
"scope": "string",
"entityId": "integer"
}
]
}
The AccessMode option is a bitmask that supports the following values:
create = 1 << 0,
read = 1 << 1,
modify = 1 << 2,
delete = 1 << 3
The Scope option accepts the following values:
delete /api/usergroups/{id}
{
"optimisticLock": "integer",
"permissions": [
"integer"
]
}
id: integer (path)
post /api/usergroups/{id}/permissions/delete
id: integer (path)
get /api/usergroups
get /api/usergroups/{id}/permissions
id: integer (path)
put /api/usergroups/{id}
{
"optimisticLock": "integer",
"name": "string"
}
id: integer (path)
post /api/users/{id}/permissions
{
"optimisticLock": "integer",
"permissions": [
{
"accessMode": "integer",
"scope": "string",
"entityId": "integer"
}
]
}
id: integer (path)
The AccessMode option is a bitmask that supports the following values:
create = 1 << 0,
read = 1 << 1,
modify = 1 << 2,
delete = 1 << 3
The Scope option accepts the following values:
post /api/users
{
"userName": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"groupsId": "number[]",
"accountType": "string"
}
The accountType option accepts the following values:
delete /api/users/{id}
id: integer (path)
post /api/users/{id}/permissions/delete
{
"optimisticLock": "integer",
"permissions": [
{
"accessMode": "integer",
"scope": "string",
"entityId": "integer"
}
]
}
id: integer (path)
The AccessMode option is a bitmask that supports the following values:
create = 1 << 0,
read = 1 << 1,
modify = 1 << 2,
delete = 1 << 3
The Scope option accepts the following values:
get /api/users
get /api/users/{id}/photo
id: integer (path)
get /api/users/{id}/permissions
id: integer (path)
put /api/users/{id}
{
"optimisticLock": "integer",
"firstName": "string",
"lastName": "string",
"email": "string",
"groupsId": [
"integer"
],
"active": "boolean"
}
id: integer (path)