cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

I have trouble creating a dataset with multiple tables via PowerBI RestAPI call

I created a C# app, which can create a dataset I define via json format inside my PowerBI workspace. This works fine, if I create a dataset, which has only one table like the following: 

 

 

 

 

string datasetJson = "{\"name\":\"TestSeveralTables\",\"defaultMode\":\"Push\",\"tables\": " + 
"[{\"name\":\"ABC1\",\"columns\": [{\"name\":\"abc_abc1\",\"dataType\":\"string\"}, " +
"{\"name\":\"value_abc1\",\"dataType\":\"Int64\"}, " + 
"{\"name\":\"time_abc1\",\"dataType\":\"DateTime\"}]}]}";

 

 

 

However if I want to create a dataset with two or more tables I get a server error 400. My datasetJson string for multiple tables looks as follows: 

 

 

string datasetJson = "{\"name\":\"TestSeveralTables\",\"defaultMode\":\"Push\",\"tables\": " + 
              "[{\"name\":\"ABC1\",\"columns\": " + 
"[{\"name\":\"abc_abc1\",\"dataType\":\"string\"}," + 
"{\"name\":\"value_abc1\",\"dataType\":\"Int64\"}, " + 
"{\"name\":\"time_abc1\",\"dataType\":\"DateTime\"}]}]}" + 
"[{\"name\":\"ABC2\",\"columns\": " +
"[{\"name\":\"abc_abc2\",\"dataType\":\"string\"}, " + 
"{\"name\":\"value_abc2\",\"dataType\":\"Int64\"}, " + 
"{\"name\":\"time_abc2\",\"dataType\":\"DateTime\"}]}]}";

 

 

What am I doing wrong here? Thanks in advance. Best regards. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: I have trouble creating a dataset with multiple tables via PowerBI RestAPI call

Hi. You need to seperate tables with comma. 

 

{
"name": "SalesMarketing",
"defaultMode": "Push",
"tables":    [
{
"name": "Table1",
"columns": [
             { "name": "ProductID", "dataType": "Int64" }
           ]
},
{
"name": "Table2",
"columns": [
             { "name": "ProductID", "dataType": "Int64" }
           ]
  }
 ]
}

 

 

View solution in original post

1 REPLY 1
Highlighted
Frequent Visitor

Re: I have trouble creating a dataset with multiple tables via PowerBI RestAPI call

Hi. You need to seperate tables with comma. 

 

{
"name": "SalesMarketing",
"defaultMode": "Push",
"tables":    [
{
"name": "Table1",
"columns": [
             { "name": "ProductID", "dataType": "Int64" }
           ]
},
{
"name": "Table2",
"columns": [
             { "name": "ProductID", "dataType": "Int64" }
           ]
  }
 ]
}

 

 

View solution in original post

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!