Scroll

REST - Data Sources

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 Source JSON

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)

Example

{
  "Id":         "1",
  "Name":       "My Data Server",
  "DbType":     "MsSql",
  "Connection": "Server=DataServer;Database=Northwind;uid=username;pwd=password;",
  "Schema":     "dbo"
}

List Data Sources

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

Using curl

curl http://{webservice}/rest/datasources?sid={sid} -X GET

Example response

Status: 200 OK
[
  {
    "Id":   "0",
    "Name": "Northwind"
  },
  {
    "Id":   "1",
    "Name": "AdventureWorks"
  }
]

Show Data Source

GET /rest/datasources/{Id}

Show the properties of the data source specified by its Id.

Using curl

curl http://{webservice}/rest/datasources/{Id}?sid={sid} -X GET

Example response

Status: 200 OK

{
  "Id":         "0",
  "Name":       "Northwind",
  "DbType":     "MsSql",
  "Connection": "Server=DataServer;Database=Northwind;uid=username;pwd=password;",
  "Schema":     "dbo"
}

Create Data Source

POST /rest/datasources/{Id}

May be useful if you don't want your connection strings in the config file.

Using curl

curl http://{webservice}/rest/datasources?sid={sid} -X POST ^
  -d "{'Name':'NW','DbType':'MsSql','Connection':'Server=SRV;Database=NW;uid=ID;pwd=PW;'}"

Example response

Status: 201 Created
Location: /{webservice}/rest/DataSources/2 { "Id": "2", "Name": "NW", "DbType": "MsSql", "Connection": "Server=SRV;Database=NW;uid=ID;pwd=PW;", "Schema": "" }

Edit Data Source

PATCH /rest/datasources/{Id}

Only supply the properties to be edited.

Using curl

curl http://{webservice}/rest/datasources/{Id}?sid={sid} -X PATCH ^
  -d "{'Connection':'Server=SRV;Database=NW;uid=Admin;pwd=Password;'}"

Example response

Status: 204 No Content

Delete Data Source

DELETE /rest/datasources/{Id}

Using curl

curl http://{webservice}/rest/datasources/{Id}?sid={sid} -X DELETE

Example response

Status: 204 No Content

Hidden Article Information

Article Author
Exago Development
created 2017-02-21 17:17:23 UTC
updated 2017-04-05 21:01:10 UTC

Labels
REST, API, Web Service, DataSources,
Have more questions? Submit a request