VersionOne:使用C#V1 API / JSON中的附件报告积压项目,任务和缺陷

时间:2013-08-22 19:28:58

标签: json api versionone

你如何查询VersionOne(V1)来构建一个报告(包含具有相关任务的积压项目,缺陷,尤其是C#中的附件给定项目?有没有人 C#V1关于如何执行此操作的API / JSON示例?我需要查询VersioOne的部分并将附件提取到目录。我可以执行报告部分。

谢谢,

雷米

1 个答案:

答案 0 :(得分:1)

我建议使用您喜欢的任何C#HTTP库。将以下查询提交至~/query.v1。查询文本可以在POST正文或名为query的GET url参数中:

where:
  Name: Whatever Project You Want
from: Scope
select:
  - Name
  - from: Workitems:PrimaryWorkitem
    select:
      - AssetType
      - Number
      - from: Attachments
        select:
          - Name
          - Description
          - ContentType
          - Content
      - from: Children:Task
        select:
          - Name
          - Number
          - AssetType
          - from: Attachments
            select:
              - Name
              - Description
              - ContentType
              - Content

在上面,我选择Attachment.Content,它会在输出中产生base64 blob。附件内容网址不在query.v1可以选择的任何属性中,但您可以通过将附件ID附加到~/attachment.v1

来创建它们

结果将以简单的分层JSON响应返回:

[
 [
  {
   "_oid":"Scope:57460",
   "Name":"openAgile",
   "Workitems:PrimaryWorkitem": [
    {
      "_oid":"Story:83524",
      "AssetType":"Story",
      "Number":"S-08114",
      "Attachments":[],
      "Subs":[],
      "Children:Task": [
        {
          "_oid":"Task:86578",
          "Name":"Test Integration in Atlanta",
          "Number":"TK-11051",
          "AssetType":"Task"
        },
        {
          "_oid":"Task:86581",
          "Name":"Install In our Production environment",
          "Number":"TK-11052",
          "AssetType":"Task"
        },
        {
          "_oid":"Task:86584",
          "Name":"Document",
          "Number":"TK-11053",
          "AssetType":"Task"
        }
    ]
  },
  ]
  }
 ]
]

您也可以使用rest-1.v1端点或我们的SDK库,但对于它允许的几乎任何报告或只读查询,强烈建议使用query.v1