Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I want to load a table in Fabric following this documentation: Lakehouse management API - Microsoft Fabric | Microsoft Learn .
It uses the following API call:
POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId}/tables/demo/load
{
"relativePath": "Files/demo.csv",
"pathType": "File",
"mode": "overwrite",
"formatOptions":
{
"header": true,
"delimiter": ",",
"format": "CSV"
}
}
However for me this returns : "An invalid request has been received: ' 'loadTableRequest' is a required parameter.'."
How should I add this parameter to the request?
Solved! Go to Solution.
Hi @Anonymous ,
First, note that:
To use the Fabric REST API, you first need to get a Microsoft Entra token for the Fabric service. Then use the token in the authorization header of the API call.
You can click on the official document below to learn:
Fabric API quickstart - Microsoft Fabric REST APIs | Microsoft Learn
Second, this API is asynchronous, so it requires three steps:
Finally, run the following command in the notebook corresponding to your lakehouse, replacing "YOUR_ACCESS_TOKEN", {workspaceId}, {lakehouseId}, and the products table name with the appropriate values.
import requests
url = https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId} /tables/products/load
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {
"relativePath": "Files/products.csv",
"pathType": "File",
"mode": "overwrite",
"formatOptions": {
"header": True,
"delimiter": ",",
"format": "CSV"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
I ran it successfully.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @Anonymous ,
First, note that:
To use the Fabric REST API, you first need to get a Microsoft Entra token for the Fabric service. Then use the token in the authorization header of the API call.
You can click on the official document below to learn:
Fabric API quickstart - Microsoft Fabric REST APIs | Microsoft Learn
Second, this API is asynchronous, so it requires three steps:
Finally, run the following command in the notebook corresponding to your lakehouse, replacing "YOUR_ACCESS_TOKEN", {workspaceId}, {lakehouseId}, and the products table name with the appropriate values.
import requests
url = https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/lakehouses/{lakehouseId} /tables/products/load
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {
"relativePath": "Files/products.csv",
"pathType": "File",
"mode": "overwrite",
"formatOptions": {
"header": True,
"delimiter": ",",
"format": "CSV"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
I ran it successfully.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Thank you, the following was actually missing in my request
"Content-Type": "application/json"
btw, is there any other documentation about this api endpoint? What if I want to go beyond this example and load multiple parquet files from a folder?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
5 | |
4 | |
2 | |
2 | |
2 |
User | Count |
---|---|
18 | |
15 | |
4 | |
4 | |
4 |