Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Unknown Error on Fabric Rest API getDefinition call on Semantic Model

Hi - running into an issue trying to get the defintion of a Semantic Model in a notebook.

Note that the parameters are correct as if i drop the /getDefinition from the end I get results back as expected for the Semantic Model.

Code in notebook below

 

import requests
import json

token_string = mssparkutils.credentials.getToken("https://api.fabric.microsoft.com/")
header = {'Content-Type':'application/json','Authorization': f'Bearer {token_string}'}

addbody = {}


add_Response = requests.get(addURL,headers=header, data=json.dumps(addbody))

from pyspark.sql import SparkSession
from pyspark.sql import Row, Column
from pyspark.sql.functions import col, year, regexp_replace

# Initialize Spark Session
spark = SparkSession.builder.appName("JsonToDelta").getOrCreate()

# Extract the list of results
sourceData =add_Response.json()
print(sourceData)

5 Replies