I want to test the rest api of jira and fetch user accountID from jira.
So I used the below url
url: 'https://domain.atlassian.com/rest/api/2/user/search%3Fquery=myuser@domain.com'
But I am getting 404 ,
req: {
method: 'GET',
body: undefined,
url: '***/rest/api/2/user/search%3Fquery=myuser@domain.com'
},
Hi @Ujala Singh ,
welcome to the Atlassian community!
The probable reason, you are getting error 404, is you have %3F (encoded version of ?) instead of ? in your URL.
The URL should be:
https://domain.atlassian.com/rest/api/2/user/search?query=myuser@domain.com
Hi @Hana Kučerová , I am using that only here. While running the github action, it's encoding it, not sure why.
Error: Jira API error
at Jira.fetch (/actions-runner/_work/_actions/ujala-singh/selfhosted-jira-accountID/master/dist/index.js:1:104085)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
req: {
method: 'GET',
body: undefined,
url: '***/rest/api/2/user/search%3Fquery=myuser@domain.com'
},
res: {
headers: [Object: null prototype] {
server: [Array],
vary: [Array],
'cache-control': [Array],
'content-type': [Array],
'content-encoding': [Array],
'strict-transport-security': [Array],
date: [Array],
'atl-traceid': [Array],
'x-arequestid': [Array],
'x-aaccountid': [Array],
'x-xss-protection': [Array],
'transfer-encoding': [Array],
'timing-allow-origin': [Array],
'x-envoy-upstream-service-time': [Array],
'x-content-type-options': [Array],
connection: [Array],
'set-cookie': [Array],
'expect-ct': [Array]
},
status: 404,
body: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: ***/rest/api/2/user/search%3Fquery=myuser@domain.com</message></status>'
},
originError: Error: Not Found
at /actions-runner/_work/_actions/ujala-singh/selfhosted-jira-accountID/master/dist/index.js:1:97661
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Jira.fetch (/actions-runner/_work/_actions/ujala-singh/selfhosted-jira-accountID/master/dist/index.js:1:103974)
at async e.exports.execute (/actions-runner/_work/_actions/ujala-singh/selfhosted-jira-accountID/master/dist/index.js:1:242679)
at async exec (/actions-runner/_work/_actions/ujala-singh/selfhosted-jira-accountID/master/dist/index.js:1:8689),
source: 'jira'
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ujala Singh ,
I suspect this code
const url = format({
host: host || this.baseUrl,
pathname,
query,
})
is causing it.
I believe you don't have your variables in getAccountID correct, see here. Probably it should be something like:
pathname: `/rest/api/2/user/search`
query: `query=${useremail}`
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Hana Kučerová Hi sorry for the delayed response:
I am using this:
async getAccountID (useremail) {
return this.fetch('getAccountID', {
pathname: `/rest/api/2/user/search?query=${useremail}`,
}, {
method: 'GET',
})
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.