AnsweredAssumed Answered

I'm trying to create UserStories programmatically. I generated my APIKey and appending it to post URL.But I'm facing some issues. Here, essentially, is the code:

Question asked by nani9999 on Mar 2, 2018
Latest reply on Mar 6, 2018 by Michael Bulkeley
import requests, json   
rally_auth
= ('**uid', '***pwd')   
rally_auth_url
= 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize'   
rally_defect
= 'https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement'   
workspace_ref
= 'https://rally1.rallydev.com/slm/webservice/v2.0/workspace/123***'   
fe_project_ref
= 'https://rally1.rallydev.com/slm/webservice/v2.0/project/134***'                               
user_ref
= 'https://rally1.rallydev.com/slm/webservice/v2.0/user/106***'   
l2_ref
= 'https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/l2roadmapitem/166***'    
headers
= {"Accept": "application/json", "Content-Type": "application/json", "ZSESSIONID" : "_iv********"}    
s
= requests.Session()   
token
= '_iv**********'   
url
= rally_defect + '/create?key=' + token     
payload
= {'Workspace' : workspace_ref,     
           'Name': 'Tesing',     
           'Description': 'Testing',     
           'Project': fe_project_ref,     
           'StoryType': "New Feature",       
           'PortfolioItem' : l2_ref,     
           'Owner' : user_ref,     
           'ScheduleState':'Defined',
}   
r
= s.put(url, data=json.dumps(payload), headers=headers)    
print r.text     
print r.status_code

 

{"CreateResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Cannot parse input stream due to I/O error as JSON document: Parse error: expected '}' but saw ',' [ chars read = \u003E\u003E\u003E{\"Project\": \"https://rally1.rallydev.com/slm/webservice/v2.0/project/13453299863\",\u003C\u003C\u003C ]"], "Warnings": []}}

 

 

Outcomes