Forum Discussion
Unable to get semantic model definition via API call
I'm unable to get the semantic model definition via API call. I got status_code 202 from this
client.post(f"/v1/workspaces/{workspaceId}/items/{itemId}/getDefinition")Then I extracted x-ms-operation-id and Retry-After from the response. Waited till the Retry-After & polled this
requests.get(f"https://api.fabric.microsoft.com/v1/operations/{operation_id}", headers=headers)I got the below mentioned response
{'status': 'Succeeded', 'createdTimeUtc': '2025-07-23T09:49:32.9426438', 'lastUpdatedTimeUtc': '2025-07-23T09:49:34.2863596', 'percentComplete': 100, 'error': None}I did not get the actual definition for semantic model. Please help.
Ref: Solved: Re: can't get semantic model definition via API ca... - Microsoft Fabric Community
API Ref: Items - Get Semantic Model Definition - REST API (SemanticModel) | Microsoft Learn
Hi abhilash_o_p,
Thank you for posting your query in Microsoft Fabric Community Forum. Also, thanks to ibarrau, for his inputs on this thread.
Thanks for the detailed explanation you are actually just one step away from getting the semantic model definition.You've done everything right so far: posting to the /getDefinition endpoint, handling the 202 response, waiting using Retry-After, and polling the operation status. Since the status came back as "Succeeded", the final piece is to retrieve the result of that operation.
To do that, make this follow-up call:
GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/operations/{operationId}/resultThis is the call that actually returns the full definition JSON you're looking for.
Also, refer to the below mentioned link for better understanding:
Long Running Operations - Get Operation Result - REST API (Core) | Microsoft Learn
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Community Forum.
3 Replies
- v-kpoloju-msft
Community Support
Hi abhilash_o_p,
Thank you for posting your query in Microsoft Fabric Community Forum. Also, thanks to ibarrau, for his inputs on this thread.
Thanks for the detailed explanation you are actually just one step away from getting the semantic model definition.You've done everything right so far: posting to the /getDefinition endpoint, handling the 202 response, waiting using Retry-After, and polling the operation status. Since the status came back as "Succeeded", the final piece is to retrieve the result of that operation.
To do that, make this follow-up call:
GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/operations/{operationId}/resultThis is the call that actually returns the full definition JSON you're looking for.
Also, refer to the below mentioned link for better understanding:
Long Running Operations - Get Operation Result - REST API (Core) | Microsoft Learn
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Community Forum. - ibarrau
Super User
Hi. You know I had the same issue the other day and I think the request works like that but it's not well defined. Are you trying to get definition of a semantic model published? or is it a power bi saved as project that was sync with repo. My guess is that only that last one works with the request. You can't just get definition of a pbix published. You can try raising a ticket to support or an issue here to have microsoft reply: https://community.fabric.microsoft.com/t5/Issues/ct-p/PBI_Comm_Issues
I hope that helps,
- abhilash_o_pFrequent Visitor
Hi ibarrau - My requirement is to get semantic model definition (tables used, schema used, lakehouse used, measures created, etc.) & create a new semantic model by updating the definition(tables and measures remain the same, only change will be on lakehouse and schema). I'm not sure how I can do that with definition in this manner
{ "displayName": "SemanticModel 1", "description": "A semantic model description.", "definition": { "parts": [ { "path": "model.bim", "payload": "ew0KICAiY29tcGF0a..GVzIjogWyBdDQogIH0NCn0=", "payloadType": "InlineBase64" }, { "path": "definition.pbism", "payload": "ewogICJ2ZXJzaW9uI..NldHRpbmdzIjoge30KfQ==", "payloadType": "InlineBase64" }, { "path": ".platform", "payload": "ZG90UGxhdGZvcm1CYXNlNjRTdHJpbmc=", "payloadType": "InlineBase64" } ] } }