使用pyral创建与SolutionCapability关联的新功能

2024-04-19 22:34:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用PyRal的PyRal库访问Rally的restapi来尝试创建新的特性,我能够创建一个特性,但是不能关联到SolutionCapability。你知道吗

我曾尝试在Post请求中将SolutionCapability作为Json传递,该请求创建了该特性,但在Post请求中,它给出了一个解析错误,我还尝试将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)

File "C:\Python36\lib\site-packages\pyral\restapi.py", line 1024, in put raise RallyRESTAPIError(problem) pyral.restapi.RallyRESTAPIError: 422 Cannot parse object reference from "{"Parent": {"PortfolioItem_SolutionCapab": {"OID": XXXXXXXXXX, "FormattedID": "XXXX"}}}"


Tags: namerestapidataresponserequestargs特性desc
1条回答
网友
1楼 · 发布于 2024-04-19 22:34:52

请尝试在feature_data中传递父级的.ref._ref

feature_data={ "Name": feature_name,"Description":desc,"AcceptanceCriteria":acceptance_criteria,"Notes":notes,"PlannedStartDate":plannedStartDate,"Parent":p.ref,"PlannedEndDate":plannedEndDate,"ProductionDate":productionDate}

应该有帮助。你知道吗

相关问题 更多 >