Get Jira's Tickets from JIRA REST API (version 3) using Postman - jira

I'm trying to get data from JIRA REST API using this link:
https://company.atlassian.net/rest/api/3/project/search
I have also set my authorization parameters, and at my parameters I have set:
KEY: jql | VALUE: project=EG
But my return at postman is this, it doesn't returns me any ticket's data:
{
"self": "https://company.atlassian.net/rest/api/3/project/search?maxResults=50&startAt=0",
"maxResults": 50,
"startAt": 0,
"total": 0,
"isLast": true,
"values": []
}
How can I get the Jira cards data?

Looking at the JIRA REST API v3 docs, I see an Issues Search endpoint at https://your-domain.atlassian.net/rest/api/3/search. This is different from the URL you're trying - it doesn't have /project in the URL.
Try setting the jql parameter to project = EG for this API like so:
https://your-domain.atlassian.net/rest/api/3/search?jql=project%20%3D%20EG

Related

How to fetch integrated versions field in jira ticket via REST API?

How to fetch integrated versions field present in Jira ticket via REST API?
Your Integrated Version field is probably a custom field based on project version. The field is identified by its ID (e.g. customfield_10500).
If you use common REST API method to retrieve a Jira issue, you can see the field in the JSON response:
https://jira.domain.com/rest/api/2/issue/TEST-123
"fields": {
...
"customfield_10500": [
{
"self": "https://jira.domain.com/rest/api/2/version/21787",
"id": "21787",
"name": "8.0.3.0",
"archived": false,
"released": false
}
],
...
}
You can limit the request to get only that specific custom field only:
https://jira.domain.com/rest/api/2/issue/TEST-123?fields=customfield_10500
To retrieve all available project versions, you need to retrieve all project versions: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.13/#api/2/project-getProjectVersions
fixVersion is a part of a Jira issue. So for that purposes it's possible to get using get issue rest request.
Here's a reference from atlassian doc: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.13/#api/2/issue-getIssue
To grab only fixVersion field and its data, it will look like:
https://jira_url/rest/api/2/issue/$ISSUE_KEY?fields=fixVersions

In Power Automate, is there a way to filter on a Custom Field using DevOp's Send HTTP Request?

I'm trying to use Power Automate to return a custom work item in Azure DevOps using the "workitemsearch" API (via the "Send HTTP Request" action). Part of this will require me to filter based on the value of a Custom Field, however, I have not been able to get it to work. Here is a copy of my HTTP Request Body:
{
"searchText": "ValueToSearch",
"$skip": 0,
"$top": 1,
"filters": {
"System.TeamProject": ["MyProject"],
"System.AreaPath": ["MyAreaPath"],
"System.WorkItemType": ["MyCustomWorkItem"],
"Custom.RequestNumber": ["ValueToSearch"]
},
"$orderBy": [
{
"field": "system.id",
"sortOrder": "ASC"
}
],
"includeFacets": true
}
I have been able to get it to work by removing the Custom.RequestNumber": ["ValueToSearch"] but am hesitant to use that in case my ValueToSearch is found in other places like the comments of other work items.
Any help on this would be appreciated.
Cheers!
From WorkItemSearchResponse, we can see the facets (A dictionary storing an array of Filter object against each facet) only supports the following fields:
"System.TeamProject"
"System.WorkItemType"
"System.State":
"System.AssignedTo"
If you want to filter RequestNumber, you can just set it in the searchText as the following syntax:
"searchText": "RequestNumber:ValueToSearch"

TFS REST API - search

I'm trying to use the TFS REST API for searching our repo. It seems the request I have is working but I only get a count of results back and no actual result data. Probably something simple but not obvious to me.
(POST)
http://{tfsserver}:8080/tfs/{repo}/{project}/_apis/search/codesearchresults?api-version=5.0-preview.1
(Body)
{
"searchText": "what",
"$skip": 0,
"$top": 10,
"filters": null,
"sortOptions":"",
"$orderBy": null,
"includeFacets": false
}
Result: 200 OK
{
"count": 533,
"results": [],
"infoCode": 0,
"facets": {}
}
Thanks in advance.
I've tested in AzureDevOps2019.Update1.1, this API is working as expected:
Please check your DevOps server version and use other "searchText" to see whether you can get the result.

Get JIRA issue properties using JRJC search

To search for JIRA issues in Java we can use this REST
/api/2.0.alpha1/search?jql&startAt&maxResults
for example:
/api/2.0.alpha1/search?assignee=mehran
but unfrotunately, according to the documentation, the result is in this format:
{
"startAt": 0,
"maxResults": 50,
"total": 1,
"issues": [
{
"self": "http://www.example.com/jira/rest/api/2.0/jira/rest/api/2.0/issue/HSP-1",
"key": "HSP-1"
}
]
}
How can I access the other properties of issues, like: title, description, ...
Well, first of all, why are you looking at an ancient version (4.3) of the API documentation? The latest is 7.2.4, for example.
If you're also running JIRA 4.3 then you're S-O-L as at that point their REST API was in a very early state.
However if your JIRA instance is newer (if it isn't, UPGRADE) then open up the proper documentation # https://docs.atlassian.com/jira/REST/{yourVersion}/. At one point the search endpoint was improved so you could expand issues and specify exactly which custom field values you want to retrieve.

Getting Issue Type Scheme and Workflow Scheme for JIRA project using REST API

I'm doing an integration for JIRA using REST API 6.2.6. One thing that I need to do is to get Issue Type Scheme and Workflow Scheme for a project.
What I tried:
Issue Type Scheme
The only thing that I can get right now is a list of issue types using /rest/api/2/project/{projectIdOrKey}. I can't see any way of getting an ID of Issue Type Scheme. Looking at API there is no any endpoints for issue type schemes, so I guess it's not possible.
Workflow Scheme
/rest/api/2/project/{projectIdOrKey} doesn't return any information about Workflow Scheme. But there is an endpoint /rest/api/2/workflowscheme/{id}, so that means that it's possible to get ID somehow... At the end I want to get a list of workflows for a project to check transitions for an issue type.
Question
Is there any way to get the data I want? Maybe there is some hidden not documented API?
Note: I'm using only JIRA REST API.
This is what you want.
/rest/projectconfig/1/workflowscheme/{projectIdOrKey}
Latest Jira documentation provides information about the APIs which can be used to fetch details for issuetype scheme and workflow scheme. Below are the APIs which can be used for the same,
Fetching Issue type Scheme for a project Issuetype Scheme API
Rest URL:GET https://your-domain.atlassian.com/rest/api/2/issuetypescheme/project?projectId={projectId}'
Sample Response:
{
"maxResults": 100,
"startAt": 0,
"total": 3,
"isLast": true,
"values": [
{
"issueTypeScheme": {
"id": "10000",
"name": "Default Issue Type Scheme",
"description": "Default issue type scheme is the list of global issue types. All newly created issue types will automatically be added to this scheme.",
"defaultIssueTypeId": "10003",
"isDefault": true
},
"projectIds": [
"10000",
"10001"
]
}
]
}
Fetching workflow scheme configured for a project Workflow Scheme API
REST URl: GET https://your-domain.atlassian.com/rest/api/2/workflowscheme/{id}
Sample Response:
{
"id": 101010,
"name": "Example workflow scheme",
"description": "The description of the example workflow scheme.",
"defaultWorkflow": "jira",
"issueTypeMappings": {
"10000": "scrum workflow",
"10001": "builds workflow"
},
"draft": false,
"self": "https://your-domain.atlassian.net/rest/api/2/workflowscheme/101010"
}
As far as I am aware you can get the correct XML or JSON response from the
REST API:
/rest/api/2/project/{projectIdOrKey}.
Then if you want to find out the information about the workflowscheme you can do this programmatically by using the following information.
If you have an issue that you want to use then you can use it to get the workflowscheme id by doing this this:
ComponentAccessor.getWorkflowSchemeManager().getWorkflowScheme(issue.getProject()).get("id");
Then once you get the id of the workflow scheme e.g. 10, you then can get the scheme generic value as follows:
GernericValue scheme = ComponentAccessor.getWorkflowSchemeManager().getScheme(10);
Now that you have the scheme you then can get all of the workflows that are referenced in the scheme by doing this:
Collection<JiraWorkflow> workflows = ComponentAccessor.getWorkflowManager().getWorkflowsFromScheme(scheme);
Then if you want to get one workflow you will have to use:
workflows.iterator().next():
Also note, that workflows are identified by their name in JIRA as there are no id's in JiraWorkflow.
So that would be the approach I would use if I wanted to find out the workflowscheme information so I could use the id to then use the REST API:
But the main reason that you might not be able to find a workflowscheme is because it is not present in the JIRA's Issue.
Using this HTTP and inputting it into "Postman" as a get request will return all the JSON information.
Using this https://jira.atlassian.com/browse/JRA-25121/project/23 will return all the information for that project. Then using this REST API:
/rest/api/2/workflowscheme/{id}
Using this HTTP get request https://jira.atlassian.com/browse/JRA-25121/workflow/45 will get you the returned XML or JSON workflow information too.

Resources