Forum Discussion
Get Cloud Connection details in fabric using python
Hi chetanhiwale
Thank you very much lbendlin for your prompt reply.
The REST API is a good way to do this. Most cloud services provide REST apis to manage connections and gateways. You can use these apis to get the details you need.
You can also use the requests library in Python to make API calls.
First, you need to install the requests library.
You can install it using the pip command. Open your command line terminal. Enter the following command and press Enter.
Here’s a basic example:
import requests
# Replace with your API endpoint and necessary headers
api_url = "https://api.yourcloudservice.com/connections"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
connections = response.json()
for connection in connections:
print(f"ID: {connection['id']}, Connection String: {connection['connectionString']}")
else:
print(f"Failed to retrieve connections: {response.status_code}")
You can view the link below for more details:
Requests: HTTP for Humans™ — Requests 2.32.3 documentation (python-requests.org)
Python's Requests Library (Guide) – Real Python
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.