使用 VBA 從 Tuleap OpenALM 檢索資料到 Excel

使用 VBA 從 Tuleap OpenALM 檢索資料到 Excel

我正在嘗試透過 REST API 存取 Tuleap Open ALM。

我用它/api/explorer/來獲取必要的 URL:“https://openalm.mycompany.com/api/v1/users?query=asmith&limit=10

我得到正確的輸出:

"[
  {
    ""id"": 12123,
    ""uri"": ""users/12123"",
    ""real_name"": ""Alex Smith"",
    ""username"": ""asmith"",
    ""ldap_id"": ""asmith"",
    ""avatar_url"": ""/themes/common/images/avatar_default.png""
  }
]"

但是當我嘗試在追蹤器中獲取工件時,我得到的輸出為空。

網址:「https://openalm.mycompany.com/api/v1/tracker_reports/7426/artifacts?values=all&limit=50

輸出:[ ]

這是我的程式碼:

Sub GetDataFromTuleapOpenALM()
    Set objHTTP = CreateObject("MSXML2.XMLHTTP")

    myxml2 = "<platform>" & _
                "<login>" & _
                  "<userName>asmith</userName>" & _
                  "<password>getmein</password>" & _
                "</login>" & _
              "</platform>"

    strURL = "https://openalm.mycompany.com/api/v1/users?query=asmith&limit=10"
    'strURL = "https://openalm.mycompany.com/api/v1/tracker_reports/7426/artifacts?values=all&limit=50"

    objHTTP.Open "GET", strURL, myxml2
    objHTTP.setRequestHeader "Content-Type", "application/xml"
    objHTTP.send
    result = objHTTP.ResponseText
    Debug.Print (result)
End Sub

當我在 中嘗試時,我也得到一個空輸出/api/explorer/

答案1

可能的問題可能是 - 身份驗證:也許您的使用者資訊是公開/匿名可用的,但您的工件不是。 - 您的報表中沒有任何工件。

我對您的基本身份驗證有點懷疑 - 您可以嘗試將其直接放入網址中,看看這是否會產生影響,即

strURL = "https://asmith:[email protected]/api/v1/users?query=asmith&limit=10"

相關內容