Rally API:投资组合项目字段的文档列表? [英] Rally API: documentation list of fields for portfolio items?

查看:25
本文介绍了Rally API:投资组合项目字段的文档列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Rally API (http://developer.help.rallydev.com/ruby-toolkit-rally-rest-api-json) 通过 Ruby.我想查询投资组合项目的属性(字段?).我有工作代码,例如这工作正常(虽然它似乎显示名称,而不是 ID - 我期待像T30"这样的东西,但它显示这是我的倡议的名称"):

I am using the Rally API (http://developer.help.rallydev.com/ruby-toolkit-rally-rest-api-json) via Ruby. I'd like to query Portfolio items for their attributes (fields?). I have working code, e.g. this works properly (although it seems to display the name, not the ID -- I was expecting something like 'T30' but this displays 'This is the name of my initiative'):

pi_query.order = "FormattedID Asc"

通过反复试验,我也看到了

By trial and error, I also see that

pi_query.order = "Name Asc"

也能用.我的问题:我可以在这里使用什么值?我找了几个小时.Name、FormattedID 和 Description 工作;父母没有.我找不到参考文档.

works too. My question: what values can I use here? I've looked for hours. Name, FormattedID, and Description work; Parent does not. I can't find a reference doc.

(我正在尝试编写一个自定义报告,以一种更易读的方式显示投资组合项目——主题、倡议和功能以某种我可以打印的嵌套方式显示.Rally 中的投资组合层次应用程序不提供可打印的视图,所以我希望为它编写一个快速脚本.我不需要太多,主要是名称,以及事物是否是主题、倡议或功能.像这样的东西:)

(I'm trying to write a custom report that'll display Portfolio items is a more readable way -- Themes, Initiatives, and Features displayed in some sort of nested fashion that I can print. The Portfolio Hierarchy app in Rally doesn't offer a printable view, so I was hoping to write a quick script for it. I don't need much, mainly the name, and whether the thing is a theme, initiative, or feature. Something like this:)

T30 My first theme
    I65 The first initiative
        F44 The first feature under that
        F45 Another feature
    I66 Another initiative
T31 My second theme
    I67 Yet another initiative

推荐答案

我找到了.这是文档的正确链接:

I found it. Here is the correct link to the documentation:

https://rally1.rallydev.com/slm/doc/webservice/

如果您点击左侧的AllowedAttributeValue",您将获得一个属性列表.按 Ctrl-F 并搜索投资组合".当您进入标题为投资组合项目(不可创建类型)"的主标题时,有一个获取完整对象"和美化 JSON 输出"复选框.检查两者,然后点击下方的查询"按钮.您将在新窗口中看到一个对象模型.

If you click on 'AllowedAttributeValue' on the left, you'll get a list of attributes. Hit Ctrl-F and search for 'portfolio'. When you get down to the main header titled 'Portfolio Item (non-creatable type)', there's a checkbox for 'fetch full objects' and 'beautified JSON output'. Check both, then hit the 'Query' button just below. You'll get an object model in a new window.

在这个新窗口中,您可以看到所有有效的属性.例如,搜索Parent",您可以看到 Parent 哈希的有效值.其中一个键是 _refObjectName,它为您提供父节点的名称.

From this new window, you can see all of the valid attributes. For example, search for 'Parent' and you can see the valid values for the Parent hash. One of those keys is _refObjectName, which gives you the name of the parent node.

这是一个工作示例,它查询倡议并显示他们的名字和他们父母的名字.

Here is a working example, which queries for initiatives and displays their name and their parent's name.

require 'rally_api'

config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "REPLACE"
config[:password] = "REPLACE"
config[:workspace] = "REPLACE"
config[:project] = "REPLACE"
@rally = RallyAPI::RallyRestJson.new(config)

pi_query = RallyAPI::RallyQuery.new()
pi_query.type = "portfolioitem/initiative"
pi_query.fetch = "Name,FormattedID,Description,PortfolioItemTypeName,Parent"
pi_query.project_scope_up = true
pi_query.project_scope_down = true
pi_query.order = "FormattedID Asc"
pi_results = @rally.find(pi_query)

pi_results.each do |result|
   parent_name = (result.Parent == nil)? "" : "has parent \"" + result.Parent["_refObjectName"] + "\""
   puts result.FormattedID + " " + result.Name + " "  + parent_name
end

这篇关于Rally API:投资组合项目字段的文档列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆