An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
A semantic model in Microsoft Fabric acts as a business-friendly layer over raw data, enabling meaningful insights and seamless integration with tools like Power BI. Below is a step-by-step guide to creating a semantic model using the Fabric API.
Using the Fabric REST API
Step 1: Prerequisites
- Ensure you have Contributor permissions in the workspace.
- Obtain the required API scopes:
SemanticModel.ReadWrite.AllorItem.ReadWrite.All. - Verify that your Microsoft Fabric license supports semantic modeling.
Step 2: Construct the API Request
Use the following endpoint to create a semantic model:
POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/semanticModels
Replace {workspaceId} with your workspace's unique ID.
Step 3: Define the Request Body
Provide details for the semantic model, including its definition and metadata:
{
"displayName": "SemanticModel 1",
"description": "A semantic model description.",
"definition": {
"parts": [
{
"path": "model.bim",
"payload": "ew0KICAiY29tcGF0a..GVzIjogWyBdDQogIH0NCn0=",
"payloadType": "InlineBase64"
}
]
}
}
-
displayName: Name of the semantic model. -
definition: Base64-encoded payload defining the model structure.
Step 4: Execute the Request
Send the request using tools like cURL, Postman, or any HTTP client:
curl -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d @request_body.json \
"https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/semanticModels"
Step 5: Validate Response
- A
201 Createdresponse confirms successful creation. - A
202 Acceptedresponse indicates that provisioning is in progress. Use the Location header to track status.
Best Practices
- Use meaningful names and descriptions for easier identification.
- Ensure all required tables or data sources are properly linked before creating the model.
- Regularly update and maintain semantic models to reflect changes in data structures.
By following these steps, you can efficiently create and manage semantic models in Microsoft Fabric, enabling robust analytics and reporting capabilities.