Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Everyone,
I’m currently exploring the Microsoft Fabric API, specifically the Items - Create Semantic Model REST API (SemanticModel) as detailed on Microsoft Learn. Items - Create Semantic Model - REST API (SemanticModel) | Microsoft Learn
I am facing error 400 -
{"requestId":"b2bfe832-a486-4bd2-ac00-c271415768ac","errorCode":"InvalidDefinitionParts","moreDetails":[{"errorCode":"InvalidPlatformFile","message":"Invalid platform file"}],"message":"One or more definition parts missing or invalid"}
I am using structure for request boby content:
modelBim:
string modelBimContent = @"{""name"": ""SalesModel"",""model"": {""tables"": [{
""name"": ""Sales"",""columns"": [{""name"": ""SalesID"", ""dataType"": ""int""},{""name"": ""Amount"", ""dataType"": ""decimal""}]}]}}";
definitionPbism:
string definitionPbismContent = @"{""version"": ""1.0"",""connections"": [{""connectionType"": ""PowerBI"",""connectionString"": ""Server=myserver;Database=mydb;""}]}";
.platform:
string platformContent = @"{""version"": ""1.0"",""platform"": ""PowerBI"",""settings"": {""storageMode"": ""InMemory"",""queryMode"": ""DirectQuery""}}";
My questions are:
1. How can I create a semantic model Fabric API?
2.How to resolve the error.
3. Please help to provide sample request body content in Semantic model create.
4. Any another way for creating the semantic model uisng fabric API
Any help would be greatly appreciated!
Solved! Go to Solution.
The error "Invalid platform file" indicates an issue with the .platform part you supplied. How did you get this file? Did you construct is manually? There's a schema for this file, and what you've sent probably doesn't conform to that schema.
You can try creating without this part if you don't know how to construct it.
Here's a tiny one I used for testing. I created one in PBI first and exported to pbip.
{
"name": "UploadedSMTest",
"compatibilityLevel": 1550,
"model": {
"culture": "en-US",
"dataAccessOptions": {
"legacyRedirects": true,
"returnErrorValuesAsNull": true
},
"defaultPowerBIDataSourceVersion": "powerBI_V3",
"sourceQueryCulture": "en-US",
"tables": [{
"name": "Applications",
"lineageTag": "c549ffef-c9e8-4320-a6c7-1ad879c6f368",
"columns": [{
"name": "Id",
"dataType": "string",
"isNullable": false,
"sourceColumn": "Id",
"sourceProviderType": "uniqueidentifier",
"lineageTag": "26c50fc8-c33e-4719-8a9e-bc82ba1cfb48",
"summarizeBy": "none",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}, {
"name": "Name",
"dataType": "string",
"isNullable": false,
"sourceColumn": "Name",
"sourceProviderType": "nvarchar(450)",
"lineageTag": "eb2102dc-9c35-4bdd-a577-86ca938c63c2",
"summarizeBy": "none",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}, {
"name": "Ordinal",
"dataType": "int64",
"isNullable": false,
"sourceColumn": "Ordinal",
"formatString": "0",
"sourceProviderType": "int",
"lineageTag": "0a30dc9f-2112-44ca-87f7-229acfd33254",
"summarizeBy": "sum",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}, {
"name": "Logo",
"dataType": "string",
"sourceColumn": "Logo",
"sourceProviderType": "nvarchar(max)",
"lineageTag": "5ba19601-51ab-44c8-9446-82f31187ddfe",
"summarizeBy": "none",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}, {
"name": "FileName",
"dataType": "string",
"sourceColumn": "FileName",
"sourceProviderType": "nvarchar(max)",
"lineageTag": "3d6b9fc3-163a-4760-8ea5-08c737fd7d7d",
"summarizeBy": "none",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}, {
"name": "IsActive",
"dataType": "boolean",
"isNullable": false,
"sourceColumn": "IsActive",
"formatString": "\"TRUE\";\"TRUE\";\"FALSE\"",
"sourceProviderType": "bit",
"lineageTag": "33149fb3-d533-4eff-8bad-911b5ab6a54b",
"summarizeBy": "none",
"annotations": [{
"name": "SummarizationSetBy",
"value": "Automatic"
}
]
}
],
"partitions": [{
"name": "Applications",
"mode": "directQuery",
"source": {
"type": "m",
"expression": [
"let",
" Source = Sql.Database(\"xxxx-sql.database.windows.net\", \"yyyy\"),",
" dbo_Applications = Source{[Schema=\"dbo\",Item=\"Applications\"]}[Data]",
"in",
" dbo_Applications"
]
}
}
],
"annotations": [{
"name": "PBI_ResultType",
"value": "Table"
}
]
}
],
"cultures": [{
"name": "en-US",
"linguisticMetadata": {
"content": {
"Version": "1.0.0",
"Language": "en-US"
},
"contentType": "json"
}
}
],
"annotations": [{
"name": "PBI_QueryOrder",
"value": "[\"Applications\"]"
}, {
"name": "__PBI_TimeIntelligenceEnabled",
"value": "1"
}, {
"name": "PBIDesktopVersion",
"value": "2.137.1102.0 (24.10)"
}, {
"name": "PBI_ProTooling",
"value": "[\"DevMode\"]"
}, {
"name": "TabularEditor_SerializeOptions",
"value": "{\"IgnoreInferredObjects\":true,\"IgnoreInferredProperties\":true,\"IgnoreTimestamps\":true,\"SplitMultilineStrings\":true,\"PrefixFilenames\":false,\"LocalTranslations\":false,\"LocalPerspectives\":false,\"LocalRelationships\":false,\"Levels\":[\"Data Sources\",\"Shared Expressions\",\"Perspectives\",\"Relationships\",\"Roles\",\"Tables\",\"Tables/Columns\",\"Tables/Hierarchies\",\"Tables/Measures\",\"Tables/Partitions\",\"Tables/Calculation Items\",\"Translations\"]}"
}, {
"name": "__TEdtr",
"value": "1"
}
]
}
}
The error "Invalid platform file" indicates an issue with the .platform part you supplied. How did you get this file? Did you construct is manually? There's a schema for this file, and what you've sent probably doesn't conform to that schema.
You can try creating without this part if you don't know how to construct it.
Thank you, But throw 202 error still not create semantic model why?
202 is not an error, it means "Accepted" - the request was received and is being processed. You have the option of polling for the status, and for fetching the result once the operation ends.
Please read the documentation here Items - Create Semantic Model - REST API (SemanticModel) | Microsoft Learn
and here for long running operations in Fabric REST APIs Long running operations - Microsoft Fabric REST APIs | Microsoft Learn
Yes correct, But operation is failed.I think model.bim format is wrong please anyone share the model.bim structure
error:
I suggest you first create a semantic model manually, then look at its semantic model definition Items - Get Semantic Model Definition - REST API (SemanticModel) | Microsoft Learn
to get the relevant sections and then construct one for your own.
Semantic Model Definition will give payload info in Base64, you will have to decode it.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |