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
Anonymous
Not applicable

how to write schema this data in json format for post dataset in power bi rest api

 {
            "reportRefreshDate""2022-02-25",
            "userPrincipalName": "xyz@gmail.com",
            "displayName""xyz",
            "isDeleted"false,
            "deletedDate"null,
            "lastActivityDate""2022-02-25",
            "sendCount"0,
            "receiveCount"3,
            "readCount"3,
            "meetingCreatedCount"0,
            "meetingInteractedCount"0,
            "assignedProducts": [
                "MUSIC",
                "MICROSOFT "
            ],
            "reportPeriod""7"
        },
 
 
I want to write a schema for creating a dataset  using the above data
1 ACCEPTED SOLUTION

Hi @Anonymous ,

You can write the schema as follow and run the REST API Push Datasets - Datasets PostDataset to create the dataset first:

 

{
  "name": "Reportview",  //dataset name
  "defaultMode": "Push", 
  "tables": [
    {
      "name": "reporttrack", //table name
      "columns": [
        {
          "name": "reportRefreshDate",
          "dataType": "DateTime"
        },
        {
          "name": "userPrincipalName",
          "dataType": "string"
        },
        {
          "name": "displayName",
          "dataType": "string"
        },
        {
          "name": "isDeleted",
          "dataType": "bool"
        },
		 {
          "name": "deletedDate",
          "dataType": "DateTime"
        },
		 {
          "name": "lastActivityDate",
          "dataType": "DateTime"
        },
			 {
          "name": "sendCount",
          "dataType": "Int64"
        },
			 {
          "name": "receiveCount",
          "dataType": "Int64"
        },
			 {
          "name": "readCount",
          "dataType": "Int64"
        },
		  {
          "name": "meetingCreatedCount",
          "dataType": "Int64"
        },
		  {
          "name": "meetingInteractedCount",
          "dataType": "Int64"
        },
        {
          "name": "assignedProducts",
          "dataType": "string"
        },
        {
          "name": "reportPeriod",
          "dataType": "Int64"
        }
      ]
    }
  ]
}

 

yingyinr_1-1646882590559.png

Then run the REST API Push Datasets - Datasets PostRows using the below json data to add the rows into the table in above new created dataset.

 

{
  "rows": [
    {
      "reportRefreshDate": "2022-02-25",
            "userPrincipalName": "xyz@gmail.com",
            "displayName": "xyz",
            "isDeleted": false,
            "deletedDate": null,
            "lastActivityDate": "2022-02-25",
            "sendCount": 0,
            "receiveCount": 3,
            "readCount": 3,
            "meetingCreatedCount": 0,
            "meetingInteractedCount": 0,
            "assignedProducts": "MUSIC",
            "reportPeriod": "7"
    }, {
      "reportRefreshDate": "2022-02-25",
            "userPrincipalName": "xyz@gmail.com",
            "displayName": "xyz",
            "isDeleted": false,
            "deletedDate": null,
            "lastActivityDate": "2022-02-25",
            "sendCount": 0,
            "receiveCount": 3,
            "readCount": 3,
            "meetingCreatedCount": 0,
            "meetingInteractedCount": 0,
            "assignedProducts": "MICROSOFT"  ,
            "reportPeriod": "7"
    }
  ]
}

 

yingyinr_0-1646889848261.png

Best Regards

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

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

I'm not clear about your needs. Are you using the REST API Push Datasets - Datasets PostDataset? And do you want to connect the call results (in JSON format) in Power BI? If so, maybe you can refer to the following documentation links to implement it.

Importing data from JSON files and Power BI Rest APIs into Power BI

yingyinr_1-1646295800882.png

Using Power BI with JSON Data Sources and Files

yingyinr_0-1646295753459.png

Best Regards

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

I am using Push dataset rest api  and i  am trying to post the above dataset schema

Hi @Anonymous ,

You can write the schema as follow and run the REST API Push Datasets - Datasets PostDataset to create the dataset first:

 

{
  "name": "Reportview",  //dataset name
  "defaultMode": "Push", 
  "tables": [
    {
      "name": "reporttrack", //table name
      "columns": [
        {
          "name": "reportRefreshDate",
          "dataType": "DateTime"
        },
        {
          "name": "userPrincipalName",
          "dataType": "string"
        },
        {
          "name": "displayName",
          "dataType": "string"
        },
        {
          "name": "isDeleted",
          "dataType": "bool"
        },
		 {
          "name": "deletedDate",
          "dataType": "DateTime"
        },
		 {
          "name": "lastActivityDate",
          "dataType": "DateTime"
        },
			 {
          "name": "sendCount",
          "dataType": "Int64"
        },
			 {
          "name": "receiveCount",
          "dataType": "Int64"
        },
			 {
          "name": "readCount",
          "dataType": "Int64"
        },
		  {
          "name": "meetingCreatedCount",
          "dataType": "Int64"
        },
		  {
          "name": "meetingInteractedCount",
          "dataType": "Int64"
        },
        {
          "name": "assignedProducts",
          "dataType": "string"
        },
        {
          "name": "reportPeriod",
          "dataType": "Int64"
        }
      ]
    }
  ]
}

 

yingyinr_1-1646882590559.png

Then run the REST API Push Datasets - Datasets PostRows using the below json data to add the rows into the table in above new created dataset.

 

{
  "rows": [
    {
      "reportRefreshDate": "2022-02-25",
            "userPrincipalName": "xyz@gmail.com",
            "displayName": "xyz",
            "isDeleted": false,
            "deletedDate": null,
            "lastActivityDate": "2022-02-25",
            "sendCount": 0,
            "receiveCount": 3,
            "readCount": 3,
            "meetingCreatedCount": 0,
            "meetingInteractedCount": 0,
            "assignedProducts": "MUSIC",
            "reportPeriod": "7"
    }, {
      "reportRefreshDate": "2022-02-25",
            "userPrincipalName": "xyz@gmail.com",
            "displayName": "xyz",
            "isDeleted": false,
            "deletedDate": null,
            "lastActivityDate": "2022-02-25",
            "sendCount": 0,
            "receiveCount": 3,
            "readCount": 3,
            "meetingCreatedCount": 0,
            "meetingInteractedCount": 0,
            "assignedProducts": "MICROSOFT"  ,
            "reportPeriod": "7"
    }
  ]
}

 

yingyinr_0-1646889848261.png

Best Regards

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

I am not aware of a "Post dataset"  API call.  What you list looks more like a table/partition.  Please explain what you are trying to accomplish. Do you mean Push datasets?

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.