Problem Accessing Service Desk API

I have a service desk for my customer, and i have created various users in that service desk for users to log issue.

In my application I want my users to log issues from my application itself into service desk, using their credentials, but I m getting authentication error. But it works same when i use my admin credentials. 

So, my question is can i use the Service desk APIs using the customer's credentials which I have created for respective Service desk?


1 answer

0 votes

Yes, you can use the customer credentials to do things with the API.

You'll need to explain what your code is doing when it tries to authenticate, and give us the full error message.

@Nic Brough [Adaptavist] Thanks for reply.

Code I m using is : (I m getting all service desk user belongs to, Using basic authentication)

private static String makeGetRequestToServiceDesk(String userName, String password, String requestUrl) 
    		throws ServiceDeskAuthenticationException, ServiceDeskAuthorizationException {
    	InputStream in = null;
    	HttpURLConnection conn = null;
    		String base64Creds = getAuthenticationHeaderForServiceDesk(userName, password);
    		URL url = new URL(SERVICE_DESK_URL + requestUrl);
	        conn = (HttpURLConnection) url.openConnection();
	        conn.setRequestProperty("Authorization", "Basic " + base64Creds);
	        int code = conn.getResponseCode();
	        	throw new ServiceDeskAuthenticationException("Failed to authenticate user.");
	        	throw new ServiceDeskAuthorizationException("Failed to authorize user.");
	        in = new BufferedInputStream(conn.getInputStream());
	        String result = IOUtils.toString(in, "UTF-8");
	        String a = "";
	        return result;
		} catch (IOException e) {
			Activator.logError("Error making GET request to service desk: ",
    	finally {
		return null;

Error I m getting is: Server returned HTTP response code: 401 for URL:

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,063 views 13 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot