【问题标题】:Using pyral to create a new feature associated with a SolutionCapability使用 pyral 创建与 SolutionCapability 关联的新功能
【发布时间】:2019-09-09 08:34:43
【问题描述】:

我正在尝试使用 python 的 PyRal 库访问 Rally 的其余 api 以尝试创建新功能,我能够创建一个功能但无法关联到 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 行,输入 引发 RallyRESTAPIError(问题) pyral.restapi.RallyRESTAPIError:422 无法解析来自“{“Parent”的对象引用:{“PortfolioItem_SolutionCapab”:{“OID”:XXXXXXXXXX,“FormattedID”:“XXXX”}}}”

【问题讨论】:

    标签: python rally pyral


    【解决方案1】:

    请尝试在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}
    

    应该有帮助。

    【讨论】:

    • 感谢您的建议,“ref”不起作用,但“_ref”起作用,谢谢,再提一个建议,根据我的要求,我还需要发送用户发送的任何附件,是可能,如果是这样怎么办????...谢谢
    • 请接受我的回答,然后为您的第二个帖子创建一个新帖子,有人/或我会帮助您。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-15
    • 2011-06-18
    • 1970-01-01
    相关资源
    最近更新 更多