簡體   English   中英

JIRA rest api來獲取活動流

[英]JIRA rest api to fetch the activity stream

我正在嘗試使用下面的api獲取我的jira實例的活動流並且它不起作用,有人能指出我正確的方向嗎?

您應該查看此頁面: https//developer.atlassian.com/docs/atlassian-platform-common-components/activity-streams/consuming-an-activity-streams-feed

僅當您還在Feed閱讀器中登錄時,活動流的Atom Feed才能正常運行。

以下是使用基本身份驗證通過Jira API使用活動流的示例。 這是在C#中,但基本模式可以應用於任何地方:

string myJiraUsername = "username";
string myJiraPassword = "password"; //or API token
string authenticationHeaderValue = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(myJiraUsername + ":" + myJiraPassword));

System.Net.Http.HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authenticationHeaderValue);
Task<HttpResponseMessage> task = client.GetAsync("https://mycompany.atlassian.net/activity");
task.Wait();
HttpResponseMessage response = task.Result;

string resultOfApiCall = "";
if (response.IsSuccessStatusCode)
{
    resultOfApiCall = response.Content.ReadAsStringAsync().Result;
    Console.WriteLine("This was returned by your API request:\n" + resultOfApiCall);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM