Querying user details from accountId

Hi Community,
Due to GDPR it’s not advisable to store user details it’s advisable to store account id and query user details when needed. I am trying to implement the same .
I am able to query current user whenever required calling myself user API. But I also need to fetch user details of some other users whose account Id I have stored in my local database.
Below is the code I am using to do so on the server side in my nodejs app

let user_url = "/rest/api/3/user/?accountId=" + account_id;
    let httpClient = addon.httpClient(req);

    httpClient.get(
      {
        url: user_url,
        contentType: "application/json",
        json: true,
      },
      (error, response, body) => {
        console.log(body);
        res.end(JSON.stringify(body));
      }
    );

I am getting response as "Specified user does not exist or you do not have required permissions"

Can someone guide me on rightway to do this ? How are others doing this ?

You’re more than likely getting bit by Important Change to the /rest/api/$/user endpoint coming soon for Jira Cloud

1 Like

Thanks for sharing this probably you are right but what’s the workaround to this problem I am have an app which is storing accountId of customer in JSD & agent. When I am displaying details to both of them I need their names ?

There isn’t any. Point the customer to the Atlassian documentation to give your app the proper access and redirect them to Atlassian Support if they need further assistance.

Understood so we have two choices either to ask for dedicated user from customer to make such calls or tell them to give browse permissions to required user groups. Looks like I thought of developing an app at wrong time :neutral_face:

Are you aware of any timeline when this comes to force ? Will myself continue working or that will also break ?

Thanks

If users have browse user permission than simply this will also work

let url = "/rest/api/3/user?accountId=" + accountId;
        AP.request(url) //eslint-disable-line no-undef
          .then((data) => {
            user = JSON.parse(data.body);
            resolve(user);
          })
          .catch((e) => console.log(e.err));