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.
Note. All requests require Session Id URL parameter and basic request headers. In the following examples, headers are omitted for clarity.
Data Sources are represented as JSON objects with the following properties:
Name | Type | Writeable | 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 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/{Id}
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