Exago Logo
Search
Generic filters
Exact matches only

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.

Important

All requests require a Session ID URL parameter and basic request headers. In the following document, headers are omitted for clarity.

Data Source JSON

Data Sources are represented as JSON objects with the following properties:

NameTypeWritableDescription
IdstringnoThe unique Id of this data source
NamestringyesThe name of this data source
DbTypeenumyes (“MsSql”)Data Source Type
ConnectionstringyesThe connection string of this data source
SchemastringyesThe 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 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.

NameTypeDescription
IdstringThe unique Id of this data source
NamestringThe 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

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
Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents