Forum Discussion
Creating a dataset with Power BI's REST API and associate it with a custom connector
Hi denodolabs ,
I have checked the docs about API and I found that you cant define the datasource in API which is not allowed,in API,you can only define table and its name,in table,you can define columns,measures,name and rows.So better remove the definition about datasource and check whether it works.
Here is the reference: https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdataset#datasource
Best Regards,
Kelly
I have checked the docs about API and I found that you cant define the datasource in API which is not allowed
Does this mean that it is not possible to create a dataset with an associated datasource in order to get the data through it? Note that I don't want to define the datasource while defining the dataset, I just want to add the reference to my datasource (previously created using the API) to have a dataset with data coming from a data source through the Gateway.
According to the documentation, when you post a dataset you can add a "datasources" property in the request body (https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdataset#request-body). This is supossed to allow you to set the datasources associated with this dataset. So this is what I was trying to use to create a dataset, using the API, from the data I get through a certified custom connector in my Gateway. Maybe this is not the proper way to specify what I need. I will be grateful for any help you can provide.
Moreover, I've tried creating datasets without datasources using the API and it works but that doesn't cover my scenario. I need the data to come from a data source.
Thank you.
- denodolabs6 years agoFrequent Visitor
I would also like to mention that one of the things that makes me doubt about the API capacity for my scenario is the defaultMode property and its possible values. According to the documentation (https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdataset#datasetmode), the values are AsAzure, AsOnPrem, Push, PushStreaming and Streaming. At first glance, it might appear that what I need is an AsOnPrem dataset but the description says "A dataset with a live connection to On-premise Analysis Service". Since I am not working with Analysis Service, I understand that it would not work for me.
Test:
{
"name": "datasettest",
"defaultMode": "AsOnPrem",
"datasources": [
{
"connectionDetails": "{\"extensionDataSourceKind\":\"DenodoForPowerBI\",\"extensionDataSourcePath\":\"{\\\"DSN\\\":\\\"DenodoODBC\\\"}\"}",
"gatewayId": "52bbd773-b6c2-4b86-a6f0-e8a15551bc03"
}
],
"tables": []
}Error:
{
"error": {
"code": "FailedToDeserializeDatasetError",
"pbi.error": {
"code": "FailedToDeserializeDatasetError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}Therefore, among the other options, the Push mode seems to be the most suitable. However, setting this type, can a dataset be connected through the gateway in order to get its data from a custom connector?
In the example above, if I set "Push" instead of "AsOnPrem" I get the same error.
Thank you.