0

我正在尝试使用 python 的 PyRal 库访问 Rally 的其余 api 以尝试创建新功能,我能够创建一个功能但无法关联到一个SolutionCapability.

我尝试SolutionCapability在创建功能的 Post 请求中传递 as 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 行,放入 raise RallyRESTAPIError(problem) pyral.restapi.RallyRESTAPIError: 422 Cannot parse object reference from "{"Parent": {" PortfolioItem_SolutionCapab": {"OID": XXXXXXXXXX, "FormattedID": "XXXX"}}}"

4

1 回答 1

1

请尝试通过.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}

它应该有帮助。

于 2019-09-11T18:21:10.863 回答