I have created Auth provider in Salesforce, linked it with Named credentials and it Authenticated successfull, now I am doing callout using below apex.

apex class:

private static string dashboardEndpoint = 'callout:IntegrateJira/rest/api/3/dashboard';
private static string issueEndpoint ='callout:IntegrateJira/rest/api/3/issue/IN-1/properties/issue.support';
private static string userEndpoint ='callout:IntegrateJira/rest/api/3/user';     

public static void jiraCallout() {

    HttpRequest req = new HttpRequest();
    Http http = new Http();
    HTTPResponse res = http.send(req);

I get status code 200 if I am using dashboardEndpoint but if I use any other end point, I am keep getting below error

Status code 401 Client must be authenticated to access this resource

and on Named Credentials I can see status is Authenticated what other type of authentication is it expecting, can someone please suggest?

  • does the user (on behalf of you are hitting the endpoints) have access to the dashboard? Commented Jun 10, 2020 at 7:20
  • no, I am the only user. there is no other user created so far
    – gs650x
    Commented Jun 10, 2020 at 7:21
  • Could you please make sure you have access to the dashboards, this might be the issue, or may be try to hit the url with another client like postman? Commented Jun 10, 2020 at 8:36
  • I am the system administrator in JIRA and I can access only dashboards not any other thing.
    – gs650x
    Commented Jun 10, 2020 at 8:55

1 Answer 1


This guide helped me to successfully do APIs call with OAuth 2.0: https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/

You can follow the guide to find your cloudId and then I think the only changes you need to make are :

  1. Change the URL for your Named Credential to https://api.atlassian.com

  2. Change the request endpoint to:'callout:IntegrateJira/ex/jira/' + CLOUDID + API; .

    For example: https://api.atlassian.com/ex/jira/11223344-a1b2-3b33-c444-def123456789/rest/api/2/project

I didn't have luck with rest/api/3/user because it required 'accountId' parameter but all my other API calls worked successfully. I hope this helps.


Not the answer you're looking for? Browse other questions tagged .