我想從JIRA獲得所有工作時間。我試圖爲始這個代碼:從Jira獲得所有工作時間
import com.atlassian.jira.rest.client.JiraRestClient;
import com.atlassian.jira.rest.client.NullProgressMonitor;
import com.atlassian.jira.rest.client.domain.BasicProject;
import com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory;
import java.net.URI;
public class JiraImpl
{
private static final String JIRA_URL = "https://jira.atlassian.com";
private static final String JIRA_ADMIN_USERNAME = "test";
private static final String JIRA_ADMIN_PASSWORD = "test";
public static void main(String[] args) throws Exception
{
JiraRestClient jira;
JerseyJiraRestClientFactory clientFactory = new JerseyJiraRestClientFactory();
jira = clientFactory.createWithBasicHttpAuthentication(new URI(JIRA_URL),
JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD);
System.out.println("Connection established to >> " + JIRA_URL);
Iterable<BasicProject> allProjects = jira.getProjectClient().getAllProjects(new NullProgressMonitor());
}
}
,但我得到:Caused by: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 401
什麼是正確的方式來獲得所有項目?
401的意思是「未經授權」的,所以有一些錯誤或者憑據您使用(你能與用戶手動登錄?),或在「測試」用戶的權限(可你的用戶看到任何項目?),或者你創建客戶端的方式。 – GlennV
另外:您的問題的標題似乎與問題本身沒有關係? – GlennV