Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rbroida
Helper I
Helper I

How to call PostDatasetInGroup() to create datasets populated by an OData service?

I want to write a C# program to automate the creation of datasets in an app workspace in Power BI Service. I want the program to create 50 datasets by posting JSON dataset definitions to PostDatasetInGroup() 50 times. Each time the program calls PostDatasetInGroup() I want it to:

 

  1. Give the dataset a unique name
  2. Define a table in the dataset
  3. Set the Datasource property of the dataset to specify an OData service hosted in the cloud
  4. After calling PostDatasetInGroup(), the program will call the Refresh API, and that dataset will query the OData service to get its data (it will _not_ call PostRowsInGroup())

My first question: is this possible? In particular, are steps 3 and 4 possible?

 

I have read this tutorial, which explains how to do steps 1 and 2, but says nothing about whether step 3 is possible: https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-create-dataset

 

Second question: if step 3 is possible, how do I correctly define the Datasource property in JSON, so as to specify that the data comes from an OData service? I've found no examples.

 

Here is the documentation for PostDatasetInGroup(), where it discusses the Datasource property (and its dependent type, DatasourceConnectionDetails), but again, gives no examples, and specifically no example of how to specify in JSON that the datasource is an OData service: https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdatasetingroup#datasour...

 

So if the answer to my first question is No, then I'd appreciate someone saying so. If it is Yes, then I'd appreciate some help figuring out how to write the JSON.

 

Thanks,

 

Richard

1 ACCEPTED SOLUTION
rbroida
Helper I
Helper I

I will also point out this page in the API documentation. Are these limitations that apply to PostDatasetInGroup()?

 

https://docs.microsoft.com/en-us/power-bi/developer/api-dataset-properties

 

View solution in original post

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @rbroida,

 

I'm afraid these documents can't be applied in your scenario. The datasets created through APIs are push dataset. The workaround is getting data from the OData service and pushing them into the dataset.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dale,

 

Unfortunately, that's what I suspected.

 

Is there an Suggestion Box where we can vote on this issue? If not I might create one.

 

Thanks,


Richard

Hi Richard,

 

I found a similar idea here. A workaround come to me is as follows. The step 2 in your first post can't be done for now. 

1. Create a pbix file in the Desktop.

2. Post the pbix file to an App workspace using imports/postimportingroup.

3. Update the data source using datasets/updatedatasourcesingroup.

4. Trigger a refresh of the dataset using datasets/refreshdatasetingroup.

You may give it a try.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rbroida
Helper I
Helper I

I will also point out this page in the API documentation. Are these limitations that apply to PostDatasetInGroup()?

 

https://docs.microsoft.com/en-us/power-bi/developer/api-dataset-properties

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.