0

I am trying to access the rest api's of Rally using PyRal library of python to try and create new features , I am able to create a feature but not able to associate to a SolutionCapability.

I have tried passing the SolutionCapability as Json in the Post request which creates the feature but the in the it give a parsing error, I have have also tried passing the ref to SolutionCapability Object,but that also does not work .

@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"}}}"

piet.t
  • 11,718
  • 21
  • 43
  • 52

1 Answers1

1

Please try to pass .ref or ._ref of parent in feature_data:

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

It should help.

user2738882
  • 1,161
  • 1
  • 20
  • 38
  • Thanks for your suggestion, "ref" did not work but "_ref" worked , thanks , just one more suggestion , as per my requirement I am also required to send any attachment which user sends , is that possible , if so how ????...thanks – Vivek Kumar Sep 16 '19 at 12:04
  • Please accept my answer then and create a new post for your second and someone / or me will help you. – user2738882 Sep 16 '19 at 13:31