JIRA rest api to fetch the activity stream

大憨熊 提交于 2019-12-13 15:14:01

问题


I am trying to get activity stream of my jira instance using the below api and it is not working , can anybody point me in the right direction ?


回答1:


You should check this page out: https://developer.atlassian.com/docs/atlassian-platform-common-components/activity-streams/consuming-an-activity-streams-feed

The Atom feed of the activity stream works well only if you also log in in your feed reader.




回答2:


Here is an example of consuming the activity stream through the Jira API using Basic Authentication. This is in C#, but the basic pattern can be applied anywhere:

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);
}


来源:https://stackoverflow.com/questions/27559417/jira-rest-api-to-fetch-the-activity-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!