我正在尝试访问Rally的rest,使用python的PyRal库来尝试并创建新的特性,我能够创建一个特性,但不能关联到一个SolutionCapability。
我尝试在Post请求中将SolutionCapability作为Json传递,这会创建特性,但是在它中会出现一个解析错误,我也尝试将ref传递给SolutionCapability Object,但这也不起作用。
@app.route("/createFeature", methods=['POST'])
def createFeature():
parent = rally.get('PortfolioItem/SolutionCapability',fetch=True,query='FormattedID = XXXXXX')
data={}
data1={}
p=parent.next()
data["OID"]=p.oid
data["FormattedID"]=p.FormattedID
data1["PortfolioItem_SolutionCapab"]=data
feature_name=request.args['name']
desc=request.args['desc']
acceptance_criteria=request.args['AcceptanceCriteria']
plannedStartDate=request.args['PlannedStartDate']
plannedEndDate=request.args['PlannedEndDate']
productionDate=request.args['ProductionDate']
notes=request.args['Notes']
feature_data={ "Name": feature_name,"Description":desc,"AcceptanceCriteria":acceptance_criteria,"Notes":notes,"PlannedStartDate":plannedStartDate,"Parent":data1,"PlannedEndDate":plannedEndDate,"ProductionDate":productionDate}
response = rally.create("Feature",feature_data)
return response.details()
response = rally.create("Feature",feature_data)文件"C:\Python36\lib\site-packages\pyral\restapi.py",第1024行,在put OID(Problem) pyral.restapi.RallyRESTAPIError: 422中,无法解析来自“{”父级:{"PortfolioItem_SolutionCapab":{“PortfolioItem_SolutionCapab”:XXXXXXXXXX,"FormattedID":“XXXX}”的对象引用。
发布于 2019-09-11 18:21:10
请试着在.ref中传递父母的._ref或feature_data
feature_data={ "Name": feature_name,"Description":desc,"AcceptanceCriteria":acceptance_criteria,"Notes":notes,"PlannedStartDate":plannedStartDate,"Parent":p.ref,"PlannedEndDate":plannedEndDate,"ProductionDate":productionDate}应该会有帮助的。
https://stackoverflow.com/questions/57850417
复制相似问题