Datasets - Get Datasources

Returns a list of datasources for the specified dataset from "My Workspace".

Required scope: Dataset.ReadWrite.All or Dataset.Read.All
To set the permissions scope, see Register an app.

GET https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/datasources

URI Parameters

Name In Required Type Description
datasetId
path True
  • string
uuid

The dataset id

Responses

Name Type Description
200 OK

OK

Examples

cached model example
direct query model example

cached model example

Sample Request

GET https://api.powerbi.com/v1.0/myorg/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229/datasources

Sample Response

{
  "value": [
    {
      "datasourceType": "AnalysisServices",
      "datasourceId": "f8c56590-43cb-43bf-8daa-233ba2520f55",
      "gatewayId": "1f69e798-5852-4fdd-ab01-33bb14b6e934",
      "connectionDetails": {
        "server": "My-As-Server",
        "database": "My-As-Database"
      }
    },
    {
      "datasourceType": "Web",
      "datasourceId": "96e4bb31-7b77-4b6d-8483-d76855639a23",
      "gatewayId": "7f1c4e55-544b-403f-b132-da0d3a024674",
      "connectionDetails": {
        "url": "http://myWebSource.com"
      }
    }
  ]
}

direct query model example

Sample Request

GET https://api.powerbi.com/v1.0/myorg/datasets/cfafbeb1-8037-4d0c-896e-a46fb27ff229/datasources

Sample Response

{
  "value": [
    {
      "name": "301",
      "connectionString": "data source=MyServer.database.windows.net;initial catalog=MyDatabase;persist security info=True;encrypt=True;trustservercertificate=False",
      "datasourceType": "Sql",
      "datasourceId": "16a54ccd-620d-4af3-9197-0b8c779a9a6d",
      "gatewayId": "7f1c4e55-544b-403f-b132-da0d3a024674",
      "connectionDetails": {
        "server": "MyServer.database.windows.net",
        "database": "MyDatabase"
      }
    }
  ]
}

Definitions

Datasource

A Power BI datasource

DatasourceConnectionDetails

A Power BI datasource connection details

Datasources

Odata response wrapper for a Power BI datasource collection

Datasource

A Power BI datasource

Name Type Description
connectionDetails

The datasource connection details

connectionString
  • string

The datasource connection string. Available only for DirectQuery.

datasourceId
  • string

The bound datasource id. Empty when not bound to a gateway.

datasourceType
  • string

The datasource type

gatewayId
  • string

The bound gateway id. Empty when not bound to a gateway.

name
  • string

The datasource name. Available only for DirectQuery.

DatasourceConnectionDetails

A Power BI datasource connection details

Name Type Description
database
  • string

The connection database

server
  • string

The connection server

url
  • string

The connection url

Datasources

Odata response wrapper for a Power BI datasource collection

Name Type Description
odata.context
  • string

OData context

value

The datasource collection