Ask a Question
Back to All

How to connect target process with python to fetch user stories

import requests

Define the API endpoint

endpoint = "https://tpdev.gad.local/api/v1/UserStories"

Add your API token to the headers

headers = {
"Authorization": "Bearer [MzA6RTlPWTZ2N0hPa2tqTE5QdHFNYkVtWnhNRU5BQjNHaW1CS1ZsNWJ3SFkyTT0=]",
"Content-Type": "application/json"

Make the API call and get the response

response = requests.get(endpoint, headers=headers)

Check the response status code

if response.status_code == 200:
# Parse the JSON data
data = response.json()
# Print the user data
# Handle error
print("Error fetching user data:", response.text)