Fetch Reference Object values from actual JSON response of tRestClient for Rally API

Highlighted
Seven Stars

Fetch Reference Object values from actual JSON response of tRestClient for Rally API

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) 

 

Seven Stars

Re: Fetch Reference Object values from actual JSON response of tRestClient for Rally API

@rhall_2_0 : As usual, I expect your response to my new post too Smiley Happy

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

Community Manager

Re: Fetch Reference Object values from actual JSON response of tRestClient for Rally API

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.

Seven Stars

Re: Fetch Reference Object values from actual JSON response of tRestClient for Rally API

Thank you for the response.

But if I use tExtractJson, I can fetch the url as userstories._ref but not
the values from the url. Now I need all FormattedID's under userstories url.
Can I achieve that using tExtractJson. If yes, kindly suggest how ?
Community Manager

Re: Fetch Reference Object values from actual JSON response of tRestClient for Rally API

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.

Seven Stars

Re: Fetch Reference Object values from actual JSON response of tRestClient for Rally API

Sure... Thank you for the reply

I expected a workaround where I can pass few parameters in parent URL and
fetch the values from reference object.

Will design the code accordingly

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog