Hi everyone,
We are developing some JIRA Cloud addons and we have a problem while calling the search REST (/rest/api/2/search) to look for some issues with the currentUser() function in the jql we passed to it as a parameter.
The problem is that if we use this REST call externally, using Curl or whatever, we are returned some issues as data(we tried with the basic auth header with the same user that is working in JIRA with the addon). But, if we do the REST call from inside the addon, although the same user is provoking the REST call, we have no data returned back.
This is the code we use to make the REST call (admin is the user who is using JIRA with our addon, so it should be the currentUser. Moreover, admin is the user used on the basic auth of the external REST call):
addon.httpClient({
clientKey: theClientKey,
userKey: admin,
appKey: theAppKey
}).get(
{
url: '/rest/api/2/search?&jql=assignee=' + currentUser()
},
function (err, httpResponse, body) {
//httpResponse.statusCode was 200
//JSON.parse(body) was { startAt: 0, maxResults: 100, total: 0, issues: [] }
}
);
Why is currentUser() function working in a different way for that situations?
Thanks!