Forum Discussion
Does anyone knows how to run a http call in a notebook
I am reading a MS documentation, it says one can refresh sql endpoint meta data via a http call:
How can I run a http call in notebook? Is it complicated?
Hi Jeanxyz,
You can run HTTP calls directly from a notebook in Microsoft Fabric using Python, and it's straightforward if you use the popular requests library. This approach works in both Spark and non-Spark Python environments.
import requests url = "https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{sqlEndpointId}/refreshMetadata" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN" } response = requests.post(url, headers=headers) print(response.status_code) print(response.text)Replace {workspaceId}, {sqlEndpointId}, and YOUR_ACCESS_TOKEN with your actual values. You must provide a valid Azure AD access token, this usually involves authentication, which can be handled via Azure Identity, MSAL, or other SDKs that you may already use for automation.
Hope that helps
Onur
😊If this post helped you, feel free to give it some Kudos! 👍
✅And if it answered your question, please mark it as the accepted solution.
3 Replies
- OnurOzResolver III
Hi Jeanxyz,
You can run HTTP calls directly from a notebook in Microsoft Fabric using Python, and it's straightforward if you use the popular requests library. This approach works in both Spark and non-Spark Python environments.
import requests url = "https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlEndpoints/{sqlEndpointId}/refreshMetadata" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN" } response = requests.post(url, headers=headers) print(response.status_code) print(response.text)Replace {workspaceId}, {sqlEndpointId}, and YOUR_ACCESS_TOKEN with your actual values. You must provide a valid Azure AD access token, this usually involves authentication, which can be handled via Azure Identity, MSAL, or other SDKs that you may already use for automation.
Hope that helps
Onur
😊If this post helped you, feel free to give it some Kudos! 👍
✅And if it answered your question, please mark it as the accepted solution.
- v-karpurapudCommunity Support
Hi Jeanxyz
Thanks for reaching out to the Microsoft fabric community forum.
I would also take a moment to thank OnurOz , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I hope the shared details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
Best Regards,
Community Support Team. - v-karpurapudCommunity Support
Hi Jeanxyz
We would like to confirm whether the issue has been resolved. If it is still outstanding, please share any additional information so we can assist you further.
Thank you.