Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Failing: CloneTileInGroupAsync() in .NET API v2

We are writing a C# application to automate the creation of datasets for specific customers in a Power BI Embedded Capacity (v2). We are using latest versions of the following Nuget packages: Microso...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Three weeks after I opened a support ticket on this, it finally got transfered to a team with REST API expertise. And they found the solution. When constructing a CloneTIleRequest object, we need to omit the target workspace id, and instead we need to include the target dataset id (which the class calls the "model ID"). So the object declaration should be:

     

    var cloneRequest = new CloneTileRequest
    {
    TargetDashboardId = newDashboard.Id,
    TargetReportId = targetReport.Id,

    TargetModelId = targetReport.DatasetId
    };

     

    In my opinion the API documentation on this is incorrect. It says: “targetModelId - string - Optional. A parameter for specifying a target model ID. When cloning a tile linked to a dataset, pass the target model ID to rebind the new tile to a different dataset.” This implies that the parameter should not be sent if a tile is linked to a report not a dataset. Our support ticket would have been unnecessary if the documentation had described the purpose of this parameter correctly. See Dashboards - Clone Tile - REST API (Power BI Power BI REST APIs) | Microsoft Docs

     

    I appreciate Microsoft support for showing us how to solve this. I wish Power BI REST APIs were better documented. And I really wish customers could get more usefull diagnostic information with API calls fail.