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

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

问题描述

我正在使用Rally API( http://developer.help.rallydev.com/ruby-toolkit-rally-rest-api-json ).我想查询Portfolio项目的属性(字段?).我有工作代码,例如可以正常运行(尽管它似乎显示的是名称,而不是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"

也可以.我的问题:在这里我可以使用什么值?我看了几个小时.名称,FormattedID和描述工作;父母没有.我找不到参考文件.

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中的投资组合层次"应用程序没有提供可打印的视图,所以我希望为此写一个快速的脚本.我不需要太多的东西,主要是名称,以及它是主题,倡议还是功能./p>

(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并搜索"portfolio".当您找到标题为"Portfolio项目(不可创建的类型)"的主标题时,会有一个复选框用于获取完整对象"和美化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.

在此新窗口中,您可以查看所有有效属性.例如,搜索父母",您可以看到父母"哈希的有效值.这些键之一是_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天全站免登陆