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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
raza19
Regular Visitor

Fabric - Create Reports model via Microsoft Fabric API

Hello Everyone,

I'm using the Microsoft Fabric REST API to programmatically deploy a report to a workspace. The semantic model already exists and is verified in the workspace.

I'm sending a POST request to (https://api.fabric.microsoft.com/v1/workspaces/${groupId}/reports😞

const reportCreated = await axios.post(
      `https://api.fabric.microsoft.com/v1/workspaces/${groupId}/reports`,
      {
        displayName: reportName,
        description: "A report description.",
        definition: {
          parts: [
            {
              path: "definition.pbir",
              payload: reportDefinationBase64,
              payloadType: "InlineBase64",
            },
            {
              path: "report.json",
              payload: reportBase64,
              payloadType: "InlineBase64",
            },
            {
              path: ".platform",
              payload: platformBase64,
              payloadType: "InlineBase64",
            },
          ],
        },
      },
      {
        headers: { Authorization: `Bearer ${creds.access_token}` },
      }
    );
 

My defination.pbir 

{
  "version": "4.0",
  "datasetReference": {
    "byPath": null,
    "byConnection": {
      "connectionString": "Data Source=powerbi://api.powerbi.com/v1.0/myorg/${org};Initial Catalog=MERINAPDTSalesSemanticModelLN;Integrated Security=ClaimsToken",
      "pbiServiceModelId": null,
      "pbiModelVirtualServerName": "sobe_wowvirtualserver",
      "pbiModelDatabaseName": "e0f124a7-cdc7-4f33-941e-8afa1bf26313",
      "connectionType": "pbiServiceXmlaStyleLive",
      "name": "EntityDataSource"
    }
  }
}

 

Confirmations:

  • The semantic model is deployed and exists in the workspace.

  • All paths and files (definition.pbir, report.json, .platform) are correctly encoded and valid.

  • The API request is authorized and reaches the endpoint

     

    Problem:

    I consistently receive the following error:
    Report Workload failed to import the report with report id 428d197b-abee-4ac0-a92f-d20be0839ba3. 

    Any ideas on what might be going wrong? Is there a hidden dependency or format requirement for .pbir or report.json when using byConnection?

 

1 ACCEPTED SOLUTION

Hi @raza19,

 

The error here is likely caused by a manually modified .pbir or report.json file, or the semantic model is not being referenced in the exact format expected by the API.

So please switch back to the byConnection which you were using earlier since the Fabric REST API supports it.

And try the above steps which i mentioned earlier like re-export the report again using power bi desktop and connect to the live semantic model in the same Fabric workspace. Do not modify any of the generated files. Encode each file in Base64 and send it to the API.

This makes sure the byConnection block is generated correctly by the backend schema.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

View solution in original post

9 REPLIES 9
v-achippa
Community Support
Community Support

Hi @raza19,

 

Thank you for reaching out to Microsoft Fabric Community.

 

The issue here is that byConnection is currently not supported for the report deployment using the Microsoft Fabric REST API. The byConnection is valid in the .pbir files when opened in the power bi desktop, but the Fabric REST API requires byPath to properly bind the report to an existing semantic model during deployment.

 

Try to use byPath instead of byConnection like this below:

{

  "version": "4.0",

  "datasetReference": {

    "byPath": {

      "workspaceObjectId": "<workspace id>",

      "datasetObjectId": "<dataset id>"

    }

  }

}

Replace <workspace id> with the actual Workspace Id where the semantic model is deployed and <dataset id> with the semantic model’s guid.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

Thanks for you response

I updated my defination file 

{
"version": "4.0",
"datasetReference": {
"byPath": {
"workspaceObjectId": "give-myId",
"datasetObjectId": "semantic-id"
}
}
}



I tried you solution and update byPath but got the error
Property 'workspaceObjectId' has not been defined and the schema does not allow additional properties. Path 'datasetReference.byPath.workspaceObjectId', line 6, position 26.
Property 'datasetObjectId' has not been defined and the schema does not allow additional properties. Path 'datasetReference.byPath.datasetObjectId', line 7, position 24.


In the documentation I found the important Not that we need to use byConnection while using Fabric API.
The Link of documentation is HERE

raza19_0-1749038995773.png

 

Let me known am i correct or doing something messy
Thanks!

 

Hi @raza19,

 

Please try re-exporting the report as a Power BI Project (.pbir) using Power bi desktop with the preview feature enabled:

  • Open Power bi desktop and connect to the exact semantic model in the Fabric workspace, go to File --> Export --> Power BI Project (.pbir).
  • Use the generated definition.pbir, report.json, and .platform files without any modifications. Encode each file in Base64 and deploy via the Fabric REST API.

This ensures all the required fields are correctly generated and match the backend schema.

 

If the issue still persists after this, double check that the semantic model is published to a Fabric enabled workspace, not a classic workspace. And share the full API error response including the inner error if available.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

Hi Anjan,

Thanks for your response

I just re-exported but that issue is still here. The error I am facing is below:

Error response:
Property 'workspaceObjectId' has not been defined and the schema does not allow additional properties. Path 'datasetReference.byPath.workspaceObjectId', line 6, position 26.
Property 'datasetObjectId' has not been defined and the schema does not allow additional properties. Path 'datasetReference.byPath.datasetObjectId', line 7, position 24.


I just try from PATH as you mentions but facing that error. The semantic model also created in Fabric enabled workspace. But somehow while creating the reports i am facing that error.
Its still not fixed 

Thanks 

Hi @raza19,

 

The error here is likely caused by a manually modified .pbir or report.json file, or the semantic model is not being referenced in the exact format expected by the API.

So please switch back to the byConnection which you were using earlier since the Fabric REST API supports it.

And try the above steps which i mentioned earlier like re-export the report again using power bi desktop and connect to the live semantic model in the same Fabric workspace. Do not modify any of the generated files. Encode each file in Base64 and send it to the API.

This makes sure the byConnection block is generated correctly by the backend schema.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

ok let me redifine the workflow again and will provide an update here.

Hi @raza19,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked?
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @raza19,

 

We wanted to kindly follow up to check if the solution I have provided for the issue worked.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @raza19,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors