Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to fetch Reference Object values (_ref) from actual JSON response using tRestClient for Rally API. Need help
tRestClient:
URL: https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/**********?fetch=UserStories
JSON Response is:
{ "Feature": { "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/************", "_refObjectUUID": "*******-****-****-***-*******", "FormattedID": "F9999", "_refObjectName": "Feature Name", "UserStories": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/PortfolioItem/Feature/************/UserStories", "_type": "HierarchicalRequirement", "Count": 2}, } }
My Reference URL Feature.UserStories._ref (_ref) https://rally1.rallydev.com/slm/webservice/v2.0/PortfolioItem/Feature/************/UserStories returns below JSON:
{"QueryResult": { "TotalResultCount": 2, "StartIndex": 1, "PageSize": 20, "Results": [ { "Expedite": false, "FormattedID": "US1234", ..... } { "Expedite": false, "FormattedID": "US5678", ..... } }}
My question is, how to fetch the values available in the Reference Object --> Feature.UserStories._ref into my actual reponse
Expected O/p:
{ "Feature": { "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/************", "_refObjectUUID": "*******-****-****-***-*******", "FormattedID": "F9999", "_refObjectName": "Feature Name", "UserStories": { "FormattedID": "US1234", "FormattedID": "US5678" } } }
I want to understand, how to pass the inputs/conditions to frame the URL (tRestClient)
@rhall : As usual, I expect your response to my new post too
Please consider with priority.
Also I wish to understand how to handle pagination for Rally API.
Is this the only way ?
Use ?start=1&pagesize=200 to fetch initial 200 records
Use ?start=201&pagesize=200 to fetch next 200 records
You would need to use the tExtractJSONFields component and make use of JSONPath to get this data. The data you want appears to be in an array so you would need to loop on that array. There are lots of descriptions on how to use JSONPath with the tExtractJSONFields component on here.
Regarding the pagination, you will need to use a tLoop for this. I describe a way of doing this here.
Sorry, I misunderstood. Just save the ref url to a globalMap variable (use the tFlowToIterate to do this), then use that globalMap value as the URL for another tRestClient.