2013-08-22 28 views

回答

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斑點。附件內容的URL中不存在的,可以通過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用於幾乎允許的任何報告或只讀查詢。

相關問題