1
votes

I'm reading the rally-node wiki and I don't get how to Read an Object. The part I don't get is the ref part.

How would I know the ref of the user story if I only know the title and the formatted ID (US5) of the story?

I know that after creating a user story I have a _ref that contains .../hierarchicalrequirement/121212121212 and by using that I can read the object, but is there another way of doing it? Since how would I know what my _ref is of a user story I created a long time ago?

Or is the best way to get user story from Rally is using restApi.query({})?

What I want to do is to return a specific user story, defect, etc from Rally with specific fetch data i.e. Formatted ID, Name, etc.

Thanks.

1

1 Answers

1
votes

Your instincts are correct- ff you only know the FormattedID or Name you'll need to just query for it.

restApi.query({
    type: 'hierarchicalrequirement', //the type to query
    fetch: ['FormattedID', 'Name', 'ScheduleState', 'Children'], //the fields to retrieve
    query: queryUtils.where('FormattedID', '=', 'US5'), //formatted id filter
    scope: {
        workspace: '/workspace/1234' //specify to query entire workspace
    }
}).then(); //process results