卷曲的行走层次结构

时间:2014-04-14 18:28:06

标签: curl rally

在尝试使用curl手动测试REST API之前,我还是试着获取一个项目列表。

使用订阅 - >工作区 - >项目深入研究了我们过于使用的流程,现在我已经列出了项目。我怀疑在REST逻辑中我没有处于某种正确的上下文中,因为我在Web界面上有许多用户故事,任务等。

/slm/webservice/v2.0/Subscription

指向

的工作区中的Count为1

/slm/webservice/v2.0/Subscription/NUMBER/Workspaces

在计数5的项目下指向:

/slm/webservice/v2.0/Workspace/NUMBER/Projects

为QueryResult提供空结果。

有什么想法吗?人们会认为走层次结构将是最基本的任务,并在某个地方写下一个例子。

2 个答案:

答案 0 :(得分:0)

以下是两个端点示例

https://rally1.rallydev.com/slm/webservice/v2.0/subscription/1111?fetch=workspaces

https://rally1.rallydev.com/slm/webservice/v2.0/workspace/2222?fetch=projects

将1111和2222分别替换为订阅的ObjectID和其中一个工作区。您可以将count添加到抓取

在WS API中v2.0 collections在同一请求中没有水合作用。

我有一个ruby示例here,用于显示工作空间中的项目,以及一个C#.NET示例here,用于获取订阅中的所有工作空间及其项目。 Ruby示例使用Rally Ruby toolkit编写,C#使用Rally .NET toolkit编写。

答案 1 :(得分:0)

Webservices API documents您需要点击的所有REST端点。

这是一个纯粹的cURL示例:

curl -u“user@company.com:topsecret”https://rally1.rallydev.com/slm/webservice/v2.0/subscription

{ "QueryResult" : { "Errors" : [  ],
      "PageSize" : 20,
      "Results" : [ { "_rallyAPIMajor" : "2",
            "_rallyAPIMinor" : "0",
            "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/12345678910",
            "_refObjectName" : "Rally Support",
            "_refObjectUUID" : "13eb4d62-3c4f-442e-b825-9f6786726d99",
            "_type" : "Subscription"
          } ],
      "StartIndex" : 1,
      "TotalResultCount" : 1,
      "Warnings" : [  ],
      "_rallyAPIMajor" : "2",
      "_rallyAPIMinor" : "0"
    } }

从上面解析订阅_ref,然后添加“/ Workspaces”:

curl -u“user@company.com:topsecret”“https://rally1.rallydev.com/slm/webservice/v2.0/subscription/12345678911/Workspaces

{ "QueryResult" : { "Errors" : [  ],
      "PageSize" : 20,
      "Results" : [ { "CreationDate" : "2004-11-28T17:50:59.000Z",
            "Description" : "",
            "Name" : "My Workspace",
            "Notes" : "",
            "ObjectID" : 12345678912,
            "Owner" : null,
            "Projects" : { "Count" : 4,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/12345678912/Projects",
                "_type" : "Project"
              },
            "RevisionHistory" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/revisionhistory/12345678915",
                "_refObjectUUID" : "272e1345-4ea4-4b62-9f23-69e90716a55e",
                "_type" : "RevisionHistory"
              },
            "SchemaVersion" : "10590c982b345c85bb0ba9b860d7fc50",
            "State" : "Closed",
            "Style" : "UserStory",
            "Subscription" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/12345678916",
                "_refObjectName" : "Rally Support",
                "_refObjectUUID" : "13eb4d62-3c4f-442e-b825-9f6786726d99",
                "_type" : "Subscription"
              },
            "TypeDefinitions" : { "Count" : 67,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/12345678917/TypeDefinitions",
                "_type" : "TypeDefinition"
              },
            "WorkspaceConfiguration" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/workspaceconfiguration/12345678918",
                "_refObjectUUID" : "e32a2a43-3735-44f9-a445-cb451f755c0f",
                "_type" : "WorkspaceConfiguration"
              },
            "_CreatedAt" : "Nov 28, 2004",
            "_objectVersion" : "8",
            "_rallyAPIMajor" : "2",
            "_rallyAPIMinor" : "0",
            "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345678912",
            "_refObjectName" : "Program 1b",
            "_refObjectUUID" : "3b0ee50b-1055-4aa0-ae8a-f6d5a2051bff",
            "_type" : "Workspace"
          }, ... truncated

从上面抓取/解析工作区_ref,将项目集合添加到水合物

curl -u“user@company.com:topsecret”https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/12345678912/Projects

{ "QueryResult" : { "Errors" : [  ],
      "PageSize" : 20,
      "Results" : [ { "BuildDefinitions" : { "Count" : 1,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/BuildDefinitions",
                "_type" : "BuildDefinition"
              },
            "Children" : { "Count" : 0,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Children",
                "_type" : "Project"
              },
            "CreationDate" : "2004-07-16T22:12:12.000Z",
            "Description" : "",
            "Editors" : { "Count" : 49,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Editors",
                "_type" : "User"
              },
            "Iterations" : { "Count" : 3,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Iterations",
                "_type" : "Iteration"
              },
            "Name" : "Project 1",
            "Notes" : "",
            "ObjectID" : 12345678920,
            "Owner" : null,
            "Parent" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/project/12345678921",
                "_refObjectName" : "Parent Project",
                "_refObjectUUID" : "673fbb47-73bf-4c11-8a03-62c27d4f718c",
                "_type" : "Project"
              },
            "Releases" : { "Count" : 2,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Releases",
                "_type" : "Release"
              },
            "SchemaVersion" : "10590c982b345c85bb0ba9b860d7fc50",
            "State" : "Closed",
            "Subscription" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/12345678910",
                "_refObjectName" : "Rally Support",
                "_refObjectUUID" : "13eb4d62-3c4f-442e-b825-9f6786726d99",
                "_type" : "Subscription"
              },
            "TeamMembers" : { "Count" : 0,
                "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/TeamMembers",
                "_type" : "User"
              },
            "Workspace" : { "_rallyAPIMajor" : "2",
                "_rallyAPIMinor" : "0",
                "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345678912",
                "_refObjectName" : "Program 1b",
                "_refObjectUUID" : "3b0ee50b-1055-4aa0-ae8a-f6d5a2051bff",
                "_type" : "Workspace"
              },
            "_CreatedAt" : "Jul 16, 2004",
            "_objectVersion" : "3",
            "_rallyAPIMajor" : "2",
            "_rallyAPIMinor" : "0",
            "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/project/12345678920",
            "_refObjectName" : "Project 1",
            "_refObjectUUID" : "332061f2-40ad-47cf-b40b-8edd3962a1e6",
            "_type" : "Project"
          },
            ... truncated     

从上面的Projects集合输出中解析特定的Project _ref,然后:

curl -u“user@company.com:topsecret”https://rally1.rallydev.com/slm/webservice/v2.0/project/12345678920

{ "Project" : { "BuildDefinitions" : { "Count" : 1,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/BuildDefinitions",
          "_type" : "BuildDefinition"
        },
      "Children" : { "Count" : 0,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Children",
          "_type" : "Project"
        },
      "CreationDate" : "2004-07-16T22:12:12.000Z",
      "Description" : "",
      "Editors" : { "Count" : 49,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Editors",
          "_type" : "User"
        },
      "Errors" : [  ],
      "Iterations" : { "Count" : 3,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Iterations",
          "_type" : "Iteration"
        },
      "Name" : "Project 1",
      "Notes" : "",
      "ObjectID" : 1154644,
      "Owner" : null,
      "Parent" : { "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/project/12345678921",
          "_refObjectName" : "Parent Project",
          "_refObjectUUID" : "673fbb47-73bf-4c11-8a03-62c27d4f718c",
          "_type" : "Project"
        },
      "Releases" : { "Count" : 2,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/Releases",
          "_type" : "Release"
        },
      "SchemaVersion" : "10590c982b345c85bb0ba9b860d7fc50",
      "State" : "Closed",
      "Subscription" : { "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/subscription/12345678910",
          "_refObjectName" : "Rally Support",
          "_refObjectUUID" : "13eb4d62-3c4f-442e-b825-9f6786726d99",
          "_type" : "Subscription"
        },
      "TeamMembers" : { "Count" : 0,
          "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/Project/12345678920/TeamMembers",
          "_type" : "User"
        },
      "Warnings" : [  ],
      "Workspace" : { "_rallyAPIMajor" : "2",
          "_rallyAPIMinor" : "0",
          "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345678912",
          "_refObjectName" : "Program 1b",
          "_refObjectUUID" : "3b0ee50b-1055-4aa0-ae8a-f6d5a2051bff",
          "_type" : "Workspace"
        },
      "_CreatedAt" : "Jul 16, 2004",
      ...truncated
      "_objectVersion" : "3",
      "_rallyAPIMajor" : "2",
      "_rallyAPIMinor" : "0",
      "_ref" : "https://rally1.rallydev.com/slm/webservice/v2.0/project/12345678920",
      "_refObjectName" : "Project 1",
      "_refObjectUUID" : "332061f2-40ad-47cf-b40b-8edd3962a1e6"
    } }