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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.