This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


Overview

The following operations allow you to work with datasets. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with datasets, see Sample configuration

OperationDescription

1Working with Datasets in Power BI

Creates a new dataset.

1Working with Datasets in Power BI

Creates a dataset in a group.

1Working with Datasets in Power BIRetrieves all datasets.
1Working with Datasets in Power BIRetrieves a JSON list from a group.

Operation details

This section provides further details on the operations related to datasets.

Creating a new dataset

The createDataset operation creates a new dataset from a JSON schema definition and returns the dataset ID and the properties of the dataset created. A dataset can be created in a group.

createDataset
<powerbi.createDataset>
    <defaultRetentionPolicy>{$ctx:defaultRetentionPolicy}</defaultRetentionPolicy>
    <datasetName>{$ctx:datasetName}</datasetName>
	<tables>{$ctx:tables}</tables>
</powerbi.createDataset>
Properties
  • defaultRetentionPolicy: Enables a default retention policy to automatically clean up old data while keeping a constant flow of new data going into your dashboard. None or basicFIFO.
  • datasetName: Name of the Dataset.
  • tables: Array of JSON objects which contain table name and columns with field names and field types.
   Sample request

Following is a sample REST/JSON request that can be handled by the createDataset operation.

Sample Request for createDataset
{
    "apiUrl": "https://api.powerbi.com",
    "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL2FuYWx5c2lzLndpbmRvd3MubmV0L3Bvd2VyYmkvYXBpIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMGQ4NTE2MGMtNTg5OS00NGNhLWFjYzgtZGIxNTAxYjk5M2I2LyIsImlhdCI6MTQ0NTU5NDYzOCwibmJmIjoxNDQ1NTk0NjM4LCJleHAiOjE0N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rflMaajYd4Z9BfWNxj87rwg44FxZkYTYeqOHXOdwyy42-H-wXMUfFwn7RA0zAyKToPrtoADr7qIjBw8dXc9NOyermuh9XfEZMqcIjIYibicRjYVYD0c9q2mSyS6sE9L4VWdTA",
    "defaultRetentionPolicy": "none",
    "datasetName": "Sample",
    "tables": [
        {
            "name": "Product",
            "columns": [
                {
                    "name": "ProductID",
                    "dataType": "Int64"
                },
                {
                    "name": "Name",
                    "dataType": "string"
                },
                {
                    "name": "Category",
                    "dataType": "string"
                },
                {
                    "name": "IsCompete",
                    "dataType": "bool"
                },
                {
                    "name": "ManufacturedOn",
                    "dataType": "DateTime"
                }
            ]
        },
        {
            "name": "Products",
            "columns": [
                {
                    "name": "ProductID",
                    "dataType": "Int64"
                },
                {
                    "name": "Name",
                    "dataType": "string"
                },
                {
                    "name": "Category",
                    "dataType": "string"
                },
                {
                    "name": "IsCompete",
                    "dataType": "bool"
                },
                {
                    "name": "ManufacturedOn",
                    "dataType": "DateTime"
                }
            ]
        }
    ]
}
Related Power BI documentation

https://msdn.microsoft.com/en-us/library/mt203562.aspx 

Creating a dataset in a group

The createGroupDataset operation creates a dataset in a group.

createGroupDataset
<powerbi.createGroupDataset>
	<groupId>{$ctx:groupId}</groupId>
	<defaultRetentionPolicy>{$ctx:defaultRetentionPolicy}</defaultRetentionPolicy>
	<datasetName>{$ctx:datasetName}</datasetName>
	<tables>{$ctx:tables}</tables>
</powerbi.createGroupDataset>
Properties
  • groupId: Group ID of the group to use.
  • defaultRetentionPolicy: Enables a default retention policy to automatically clean up old data while keeping a constant flow of new data going into your dashboard. None or basicFIFO.
  • datasetName: Name of the dataset.
  • tables: Array of JSON objects which contain table name and columns with field names and field types.
   Sample request

Following is a sample REST/JSON request that can be handled by the createGroupDataset operation.

Sample Request for createGroupDataset
{
	"apiUrl" : "https://api.powerbi.com",
	"accessToken" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWW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WQuQWxsIE1ldGFkYXRhLlZpZXdfQW55IiwiYWNyIjoiMSIsImlwYWRkciI6IjIwMy42Mi4xNzUuNCJ9.fv3ErVcHqb2KRiNsiQ2k2RImcxnCNKmzCMe2Na1_4MTEnDkpmBujqDMsAqzmDdV4fYUFwLKeXD7WSUCa2ftsYDz17j-7EI726b8HbuGemfhjirCRb0n-NQVNmUt2JiMfbF_8LmFO8hnf_Hqer6Coyf9YKWUhkm93kPBgZiZWGOIy2f6yevH2cHqe7wt1HWTmr73x2UhF1fHnkVtR1rflMaajYd4Z9BfWNxj87rwg44FxZkYTYeqOHXOdwyy42-H-wXMUfFwn7RA0zAyKToPrtoADr7qIjBw8dXc9NOyermuh9XfEZMqcIjIYibicRjYVYD0c9q2mSyS6sE9L4VWdTA",
	"groupId" : "fda86e48-d7c3-413a-a8b1-2ddafe46b511",
	"defaultRetentionPolicy" : "none",
	"datasetName": "Inventory",
      "tables": [
        {
            "name": "Product",
            "columns": [
                {
                    "name": "ProductID",
                    "dataType": "Int64"
                },
                {
                    "name": "Name",
                    "dataType": "string"
                },
                {
                    "name": "Category",
                    "dataType": "string"
                },
                {
                    "name": "IsCompete",
                    "dataType": "bool"
                },
                {
                    "name": "ManufacturedOn",
                    "dataType": "DateTime"
                }
            ]
        }
    ]
}
Related Power BI documentation

https://msdn.microsoft.com/en-us/library/mt203562.aspx

Retrieving all datasets 

The listDatasets operation retrieves a JSON list of all dataset objects which includes a name and ID or a JSON list from a group.

listDatasets
<powerbi.listDatasets>
</powerbi.listDatasets>
   Sample request

Following is a sample REST/JSON request that can be handled by the listDatasets operation.

Sample Request for listDatasets
{
	"apiUrl" : "https://api.powerbi.com",
	"accessToken" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL2FuY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RiNsiQ2k2RImcxnCNKmzCMe2Na1_4MTEnDkpmBujqDMsAqzmDdV4fYUFwLKeXD7WSUCa2ftsYDz17j-7EI726b8HbuGemfhjirCRb0n-NQVNmUt2JiMfbF_8LmFO8hnf_Hqer6Coyf9YKWUhkm93kPBgZiZWGOIy2f6yevH2cHqe7wt1HWTmr73x2UhF1fHnkVtR1rflMaajYd4Z9BfWNxj87rwg44FxZkYTYeqOHXOdwyy42-H-wXMUfFwn7RA0zAyKToPrtoADr7qIjBw8dXc9NOyermuh9XfEZMqcIjIYibicRjYVYD0c9q2mSyS6sE9L4VWdTA"
}
Related Power BI documentation

https://msdn.microsoft.com/en-us/library/mt203567.aspx

Retrieving a JSON list from a group

The listGroupDatasets operation retrieves a JSON list from a group.

listGroupDatasets
<powerbi.listGroupDatasets>
	<groupId>{$ctx:groupId}</groupId>
</powerbi.listGroupDatasets>
Properties
  • groupId: GUID of the group to use.
   Sample request

Following is a sample REST/JSON request that can be handled by the listGroupDatasets operation.

Sample Request for listGroupDatasets
{
	"apiUrl" : "https://api.powerbi.com",
	"accessToken" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL2FuYWx5c2lzLndpbmRvd3MubmV0L3Bvd2VyYmkvYXBpIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMGQ4NTE2MGMtNTg5OS00NGNhLWFjYzgtZGIxNTAxYjk5M2I2LyIsImlhdCI6MTQ0NTU5NDYzOCwibmJmIjoxNDQ1NTk0NjM4LCJleHAiOjE0NDU1OTg1MzgsInZlciI6IjEuMCIsInRpZCI6IjBkODUxNjBjLTU4OTktNDRjYS1hY2M4LWRiMTUwMWI5OTNiNiIsIm9pZCI6IjU3OWY1YzVmLTU1NjctNGY1NC04Zj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WdTA",
	"groupId" : "fda86e48-d7c3-413a-a8b1-2ddafe46b511"
}
Related Power BI documentation

https://msdn.microsoft.com/en-us/library/mt203567.aspx 

Sample configuration

Following is a sample proxy service that illustrates how to connect to Power BI with the init operation and use the createDataset operation. The sample request for this proxy can be found in the createDataset sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="powerbi_createDataset"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="defaultRetentionPolicy"
                   expression="json-eval($.defaultRetentionPolicy)"/>
         <property name="datasetName" expression="json-eval($.datasetName)"/>
         <property name="tables" expression="json-eval($.tables)"/>
         <powerbi.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </powerbi.init>
         <powerbi.createDataset>
            <defaultRetentionPolicy>{$ctx:defaultRetentionPolicy}</defaultRetentionPolicy>
            <datasetName>{$ctx:datasetName}</datasetName>
            <tables>{$ctx:tables}</tables>
         </powerbi.createDataset>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
</proxy>
  • No labels