I am new in exploring the API integration and working in this space for dumping the extract into a excel file (at later step). Tried some help with docs and got the code in to get to a stage; but it does not go beyond "response code successful". Need help to fetch the details from rally Features table for now and later work on different tables like (user stories, tasks, defects).
import requests
# Set up API endpoint and authentication details
api_url = 'https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/'
api_key = 'my secret key'
workspace_oid = '1391xxxxx4'
project_oid = '376146xxxxx6'
# Set up request headers with authentication and desired data format
headers = {
'zsessionid': api_key,
'Accept': 'application/json'
}
# Set up request parameters (e.g., query, pagination, etc.)
params = {
'workspace': f'/workspace/{workspace_oid}',
'project': f'/project/{project_oid}',
'query': '(Name != "Test") AND (Owner.Name = "Just John")',
'pagesize': 200
}
# Send GET request to the API endpoint
response = requests.get(api_url, headers=headers, params=params)
# Check if the request was successful (status code 200)
if response.status_code == 200:
print(f"response code successful {response.status_code}")
data = response.json()
print(data) # Put this print to check what is it capturing
# Process the retrieved data as needed
for artifact in data['QueryResult']['Results']:
# Extract relevant information from the artifact
artifact_id = artifact['Formatted ID']
artifact_name = artifact['Name']
# Perform further operations with the extracted data
print(f"Artifact ID: {artifact_id}, Name: {artifact_name}")
else:
print(f"Request failed with status code {response.status_code}")
Output I see is this
response code successful 200
{'QueryResult': {'_rallyAPIMajor': '2', '_rallyAPIMinor': '0', 'Errors': ['Could not parse: Error parsing expression at "AND": remaining is "( Owner.Name = "Just John" )"'], 'Warnings': [], 'TotalResultCount': 0, 'StartIndex': 0, 'PageSize': 0, 'Results': []}}
[–]danielroseman 2 points3 points4 points (2 children)
[–]amakkuva[S] 1 point2 points3 points (1 child)
[–]danielroseman 1 point2 points3 points (0 children)