How to get reporter name with API call

P C
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2020

I want to extract reporter name using REST API.

GET http://localhost:8080/rest/api/2/issue/awd-1?fields=reporter

 If I used command above I get the following extract:

{
  "expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",
  "id": "10000",
  "self": "http://localhost:8080/rest/api/2/issue/10000",
  "key": "AWD-1",
  "fields": {
    "reporter": {
      "self": "http://localhost:8080/rest/api/2/user?username=username",
      "name": "username",
      "emailAddress": "user@domain.com",
      "avatarUrls": {
        "16x16": "http://localhost:8080/secure/useravatar?size=small&avatarId=10122",
        "48x48": "http://localhost:8080/secure/useravatar?avatarId=10122"
      },
      "displayName": "User Name",
      "active": true
    }
  }
}

Now I want to get the reporter name from extract above. 

1 answer

0 votes
archit patel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 11, 2021

You can use below code :

httpClient.get(`rest/api/3/issue/${res.req.query.issueKey}`, function (err, response, body)

{

  let get_reporter_data = JSON.parse(body);

let displayName = get_reporter_data.fields.reporter.displayName;

console.log("reporter Name is ",displayName);

});

archit patel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 11, 2021

Hey,
How to get reporter's email address?
I am not getting email address from above API?

 

Can you please do help me on this?

Suggest an answer

Log in or Sign up to answer