A Data Source is a resource which contains or accesses the information which is reported on. Often this is a database, but a variety of types are supported. Data Sources are accessed using a connection string, which passes the location of the resource and authentication params. This endpoint allows for session-based read/write access to all data sources for the current config.
Important
All requests require a Session ID URL parameter and basic request headers. In the following document, headers are omitted for clarity.
Data Sources are represented as JSON objects with the following properties:
Name | Type | Writable | Description |
---|---|---|---|
Id | string | no | The unique Id of this data source |
Name | string | yes | The name of this data source |
DbType | enum | yes (“MsSql”) | Data Source Type |
Connection | string | yes | The connection string of this data source |
Schema | string | yes | The data source schema name (blank for default) |
{ "Id": "1", "Name": "My Data Server", "DbType": "MsSql", "Connection": "Server=DataServer;Database=Northwind;uid=username;pwd=password;", "Schema": "dbo" }
GET /rest/DataSources
List all the data sources in the current configuration. Output is an array of JSON objects, each representing an individual data source.
GET /rest/DataSources?config=myconfig.xml
List all of the data objects only in the user’s session specific configuration. Replace myconfig.xml with the file name of the corresponding config file name. Output is an array of JSON objects, each representing an individual data source.
Name | Type | Description |
---|---|---|
Id | string | The unique Id of this data source |
Name | string | The name of this data source |
curl http://{webservice}/rest/DataSources?sid={sid} -X GET
Status: 200 OK [ { "Id": "0", "Name": "Northwind" }, { "Id": "1", "Name": "AdventureWorks" } ]
GET /rest/DataSources/{Id}
Show the properties of the data source specified by its Id.
curl http://{webservice}/rest/DataSources/{Id}?sid={sid} -X GET
Status: 200 OK { "Id": "0", "Name": "Northwind", "DbType": "MsSql", "Connection": "Server=DataServer;Database=Northwind;uid=username;pwd=password;", "Schema": "dbo" }
POST /rest/DataSources
May be useful if you don’t want your connection strings in the config file.
curl http://{webservice}/rest/DataSources?sid={sid} -X POST ^ -d "{'Name':'NW','DbType':'MsSql','Connection':'Server=SRV;Database=NW;uid=ID;pwd=PW;'}"
Status: 201 Created Location: /{webservice}/rest/DataSources/2 { "Id": "2", "Name": "NW", "DbType": "MsSql", "Connection": "Server=SRV;Database=NW;uid=ID;pwd=PW;", "Schema": "" }
PATCH /rest/DataSources/{Id}
Only supply the properties to be edited.
curl http://{webservice}/rest/DataSources/{Id}?sid={sid} -X PATCH ^ -d "{'Connection':'Server=SRV;Database=NW;uid=Admin;pwd=Password;'}"
Status: 204 No Content
DELETE /rest/DataSources/{Id}
curl http://{webservice}/rest/DataSources/{Id}?sid={sid} -X DELETE
Status: 204 No Content