we used to have three different JIRA projects, and merged them all into one new project, resulting in new IssueKeys for all issues involved.
Unfortunately, test automation uses the IssueKey to update the issue about test results (via SQL INSERT statement), and I try to avoid updating the list of IssueKeys in the suite.
I can think of two ways:
Addressing the issues by the old IssueKey. This seems to work in JIRA JQl search (issuekey=ISSUE-OLD finds the same issue as issuekey=ISSUE-NEW ), but not for the SQL INSERT statement.
Getting a list of pairs old-new IssueKey. For example, in JIRA under "activity" and "all", I can see entries that log the changes. Exporting tose worklogs might be a great help, but there might be other ways.
Thanks in advance,
Florian
I assume you're updating a test management db, not the Jira db (which would not be good)
You might also be interested in the moved_issue_key table which is where Jira stores the previous issue keys (e.g. ABC-123) and maps them to an issue id (the id in the jiraissue table)
you can use the curl api:
curl -D- -u user:password -X GET -H "Content-Type: application/json" https://url.com/rest/api/2/issue/ISSUE-OLD
The response will contain the key value as ISSUE-NEW with other details.
Related
How to query gerrit with multiple gerrit numbers? for example, I have two gerrit with number 1234 and 5678, I wish use one query url to list all gerrits!
Maybe something like below:
http://codereview.com/a/q={1234,5678}
This is helpful, I can share one link to others for multiple gerrits review!
Use the following URL in your browser:
http://codereview.com/q/1234+OR+5678
The following command gets the information you want using the REST API:
curl --user USER:PASS --request GET "http://codereview.com/a/changes/?q=1234+OR+5678"
I am trying to get all the closed and merged commits on a certain repository using the github API (https://api.github.com/), and the only way I have found to do this is to check for commits that are closed (api.github.com/repos/user/repo/pulls?state=closed), then make sure the merged_at is not equal to null, but this is a slow way to do it. Is there a way to make github check if the PR is closed and has been merged at the same time directly in the url? Something like api.github.com/repos/user/repo/pulls?state=closed?is_merged=true? And return all the PRs matching the criteria?
NOTE: this has nothing to do with the /repos/user/repo/pulls/pr_id/merge, because that only tells you if a single pull request is merged, and does not search everywhere in the list of PRs.
You can use the “is:merged” operator in your search query
Check this out: https://docs.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-based-on-the-state-of-an-issue-or-pull-request
Request template
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/search/issues\?q\=repo:{repo_owner}/{repo}+is:pr+is:merged
Explanation:
You can't get merged pull requests by std Github API /pulls route. But you can do this using Search API.
More info in docs:
Use Search API: https://docs.github.com/en/rest/search#about-the-search-api
More tricks for search issues and prs: https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests
I need to get a nested Jira search. I am okay with JQL query but I have a usecase that I don't know how to solve
Company uses project=XTBOW for reporting purpose for executives (Epic)
The company also uses project=XTA for underling development work (Task)
The XTA task are linked to the XTBOW Epic for a subset of task, but not all. (There is a large body of XTA task that are not linked to XTBOW)
I need to get a filter going for all XTA projects that are linked to XTBOW Epics only. I would like to use a filter like this:
project = XTA and "Epic Link" in (<project = XTBOW.key>)
I can manually prove this filter works. But need a way to automate this filter, because the number of tickets being created/tracked in growing exponentially, and if someone deletes a key for XTBOW that is in the "Epic Link" field, the JQL search throws and error because the "Key" is missing.
Example - FYI cf[10231] is the "Epic Link" field:
project in (XTA,XTWOF) and cf[10231] in (XTBOW-42,XTBOW-59)
The overall objective is to download the data to a dataframe. So if there is a better suggestion to even avoid JQL and do it through python. I am all ears. Just need so pointers to start. I am just going this route because I have already built a JIRA-Downloader/Parser using Python.
The easiest way to get subsets of issues is with:
search_issues(jql_str, startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None)
You should be able to just pull the issue sets using the queries you already created, just make them into strings.
DOC
How can I run report of issues in Jira added to specific sprint after specific date ? Update date won't help as that one gets updated with lots of different actions. Any ideas?
Similarly, any way how to report on issues created in specific project / moved to specific project after specific date ?
Preferably thru Web UI, but JIRA API would be fine too.
Thanks!
So here is a little script jira-issue-search.sh:
#!/bin/bash
JIRA_USER=your_username
JIRA_PASS=your_password
JIRA_REST=http://jira.tld/rest/api/2
Q=${1?Search Query}
E=${2?Expand fields}
DATA="{\"jql\":\"${Q:q}\",\"validateQuery\":\"true\",\"startAt\":0,\"maxResults\":100,\"expand\":[\"${E:q}\"]}"
curl -s -u ${JIRA_USER}:${JIRA_PASS} -X POST -H "Accept: application/json" -H "Content-Type: application/json" --data "${DATA:q}" ${JIRA_REST}/search | json_xs -f json -t json-pretty
And you will run it as: jira-issue-search.sh 'Sprint = \"YourSprintName\"' changelog
The resulting json will have array called 'issues', which contains records with fields key and changelog/histories[]/ { items[]/field=Sprint, created > your_date }. I have a bunch of scripts to do queries in json, but you probably want to write that in whatever language you are using.
To answer the second question it depends on how you model projects. If you use jira projects, then issues cannot be moved between them so it is just creation date comparison, but if you use some custom field, you can compare on the field by searching changelog items/field = field_name and items/to = project_name and again compare created in that changelog entry to your_date.
i want to create an issue in JIRA by using the REST API provided by JIRA.
i am able to create a simple issue,
using this :
http://localhost:8080/rest/api/latest/issue
and data as follows:
{"fields":{"project":{"key": "TES"},"summary":"user name not showing validation message","description":"Hi validation is missing from user name","issuetype": {"name": "Bug"},"reporter":{"name":"BruceWayne"} }}
this is running fine.
now i want to add 3 custom fields while creating an issue. The custom fields are Authorname,
AuthorTag,AuthorID. how can i do this in rest api. what should i add in my data.
My sample data is as follows:-
{"fields":{"project":{"key": "TES"},"summary":"my bugs 5","description":"Hi","issuetype": {"name": "Bug"},
"customfield_10000":"roach#yahoo.com",
"customfield_10100":{"value":"abc"},
"reporter":{"name":"amit"},
"components": [{
"add" : {"name" : "abc"}
}],"priority": {
"id": "1"
}
}}
i want to use the names specified for customfields rather than customfield_XXXXX .
One way i think of is to hit the API after creating a simple issue ( using another API hit to get meta data as follows)
http://localhost:8080/rest/api/latest/issue/tes-79?expand=editmeta
and then do json parsing and again issue a put command to update the fields in same issue
but i was looking for a way to do it in single API hit (while creating an issue)
It should be just like setting any other field, but you have to use the field name "customfield_NNNNN" instead
I know that it is very late to answer this question, but then might help others if not the OP at this time of writing.
If you're in doubt about the create, then you could do something like this - Try a GET on an issue that you would rather create manually with the new parameters as well and then based on the output of the same you could then decide to update it with the new parameters with the new name or the old-fashioned customfield_xxx field.
Try a GET like this on cURL
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" https://jira.fred.com/rest/api/2/issue/FRD-88651
Then you could possibly do a POST like how you've done earlier:
http://localhost:8080/rest/api/latest/issue