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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ddelapasse
Helper I
Helper I

Issue trying to get Semantic Model via api

I'm making a post to {baseUrl}/workspaces/{workspaceId}/semanticModels/{semanticModelId}/getDefinition and I get a 202 with a Location url in the response header.   Then, I am doing a get to that Location url which looks like: https://wabi-us-east2-b-primary-redirect.analysis.windows.net/v1/operations/{guid}.  That returns 200.

I get only this json though: {"status":"Succeeded","createdTimeUtc":"2024-11-07T15:41:21.2885946","lastUpdatedTimeUtc":"2024-11-07T15:41:21.8198463","percentComplete":100,"error":null}

How do I get the actual semantic model json?  Is there any documentation of the handling of the 202?  Maybe something else is required?  

1 ACCEPTED SOLUTION
AmosHersch
Microsoft Employee
Microsoft Employee

What you are describing in the behavior of long running operations in Microsoft Fabric APIs.

For APIs which return a result, like the "getDefinition", once the "Get Operation State" returns 200 with status:Succeeded, it will contain another URL for fetching the result. It should look like this in your case:
 https://wabi-us-east2-b-primary-redirect.analysis.windows.net/v1/operations/{guid}/result

 

 

See this documentation for more details: Long running operations - Microsoft Fabric REST APIs | Microsoft Learn

View solution in original post

3 REPLIES 3
Dbrothers
Regular Visitor

No idea if you found resolution,  but It sounds like I have been exploring where you are.  I am by no means fluent in API, but I can give my experience/likely incorrect understanding.  Once you send the POST to actual start the process of getting the definition it makes a result file out on the server(eventually goes away btw).  The output you get back from that should have a line with this in it

"x-ms-operation-id": "{some form of a GUID}"

Then you have to send a

GET https://api.fabric.microsoft.com/v1/operations/{GUID of result from previous}/result

The output of this last command sends you the information inform of line with payload that is encoded in base64.  But nonetheless it eventually allows you to see SQL embedded in the model and other attributes.

 

What I have yet to figure out is how to actually edit that SQL, re encode base64, then update that model defintion.  At a MediaTypeError so far, and swapped away from TMDL(default of get definition) to TMSL(seems to be what update wants) format.

 

Again I am not by any means fluent in API, just wanted to give my experiences with getting to a point to read/see the definition if it helps anyone.

AmosHersch
Microsoft Employee
Microsoft Employee

What you are describing in the behavior of long running operations in Microsoft Fabric APIs.

For APIs which return a result, like the "getDefinition", once the "Get Operation State" returns 200 with status:Succeeded, it will contain another URL for fetching the result. It should look like this in your case:
 https://wabi-us-east2-b-primary-redirect.analysis.windows.net/v1/operations/{guid}/result

 

 

See this documentation for more details: Long running operations - Microsoft Fabric REST APIs | Microsoft Learn

lbendlin
Super User
Super User

Seems to be an inofficial endpoint?  The regular API still uses the "dataset" term.

 

Datasets - Get Dataset In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Helpful resources

Announcements
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.