Hello!
when we search issues via Jira rest APIs with this query:
curl \
-u [username]:[password] \
-X GET \
-H "Content-Type: application/json" \
'https://[hostname]/rest/api/2/search?jql=created>"2021-01-01"+order+by+created&fields=id,key,issuetype,assignee,created' | python3 -mjson.tool;
it will return an object like this:
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 50,
"total": 552,
"issues": [
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "15064",
"self": "https://[hostname]/rest/api/2/issue/15064",
"key": "TEST-2051",
"fields": {
"issuetype": {
"self": "https://[hostname]/rest/api/2/issuetype/10002",
"id": "10002",
"description": "A task that needs to be done.",
"iconUrl": "https://[hostname]/secure/viewavatar?size=xsmall&avatarId=10318&avatarType=issuetype",
"name": "Task",
"subtask": false,
"avatarId": 10318
},
"created": "2022-04-20T13:11:55.000+0430",
"assignee": {
"self": "https://[hostname]/rest/api/2/user?username=username",
"name": "name",
"key": "key",
"emailAddress": "mail@gmail.com",
"avatarUrls": {
"48x48": "https://[hostname]/secure/useravatar?ownerId=key&avatarId=10601",
"24x24": "https://[hostname]/secure/useravatar?size=small&ownerId=key&avatarId=10601",
"16x16": "https://[hostname]/secure/useravatar?size=xsmall&ownerId=key&avatarId=10601",
"32x32": "https://[hostname]/secure/useravatar?size=medium&ownerId=key&avatarId=10601"
},
"displayName": "displayName",
"active": true,
"timeZone": "Asia/Tehran"
}
}
}
],
"names": {
"issuetype": "Issue Type",
"created": "Created",
"assignee": "Assignee"
}
}
but I do not need to have detailed data about the assignee, I don't need avatarUrls, mail, and some other extras, I just need to get displayName, what should I do?
thank you in advance
It is not possible to limit this. When you get issue via REST API Jira return all data about issue.
After when you get response you can grep data that you want but this are additional steps.
Regards,
Seba
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Fateme Mirzaei ,
you can retrieve all information about a single issue through the following rest API https://docs.atlassian.com/software/jira/docs/api/REST/9.3.0/#api/2/issue-getIssue
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for your answer, but I don't need a single issue, I needed to retrieve a bunch of issues via search API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.