使用RESTAPI获取JIRA项目的问题类型方案和工作流方案

使用RESTAPI获取JIRA项目的问题类型方案和工作流方案,jira,jira-rest-api,Jira,Jira Rest Api,我正在使用RESTAPI6.2.6为JIRA进行集成。我需要做的一件事是为项目获取问题类型方案和工作流方案 我尝试的是: 发行类型方案 我现在唯一能得到的是使用/rest/api/2/project/{projectdorkey}的问题类型列表。我看不到任何获取问题类型Scheme的ID的方法。看看API,问题类型方案没有任何端点,所以我猜这是不可能的 工作流方案 /rest/api/2/project/{projectdorkey}不返回任何有关工作流方案的信息。但是有一个端点/rest/ap

我正在使用RESTAPI6.2.6为JIRA进行集成。我需要做的一件事是为项目获取问题类型方案工作流方案

我尝试的是: 发行类型方案

我现在唯一能得到的是使用
/rest/api/2/project/{projectdorkey}
的问题类型列表。我看不到任何获取问题类型Scheme的ID的方法。看看API,问题类型方案没有任何端点,所以我猜这是不可能的

工作流方案

/rest/api/2/project/{projectdorkey}
不返回任何有关工作流方案的信息。但是有一个端点
/rest/api/2/workflowscheme/{id}
,这意味着可以以某种方式获取id。。。最后,我想获得一个项目的工作流列表,以检查问题类型的转换

问题: 有没有办法得到我想要的数据?也许有一些隐藏的未记录的API


注意:我只使用了JIRA REST API。

据我所知,您可以从 REST API:

/rest/api/2/project/{projectIdOrKey}.  
然后,如果您想找到关于workflowscheme的信息,您可以使用以下信息以编程方式完成此操作

如果您有要使用的问题,则可以通过执行以下操作来使用该问题获取workflowscheme id:

ComponentAccessor.getWorkflowSchemeManager().getWorkflowScheme(issue.getProject()).get("id");
然后,一旦您获得工作流方案的id(例如10),您就可以获得方案通用值,如下所示:

GernericValue scheme = ComponentAccessor.getWorkflowSchemeManager().getScheme(10);
现在您有了方案,您可以通过执行以下操作获得方案中引用的所有工作流:

Collection<JiraWorkflow> workflows = ComponentAccessor.getWorkflowManager().getWorkflowsFromScheme(scheme);
另请注意,工作流在JIRA中通过其名称标识,因为JiraWorkflow中没有id。

如果我想找到workflowscheme信息,那么我会使用这种方法,这样我就可以使用id来使用REST API:

但是,您可能无法找到workflowscheme的主要原因是因为JIRA的问题中没有它

使用此HTTP并将其作为get请求输入“Postman”将返回所有JSON信息

使用此选项将返回该项目的所有信息。然后使用此REST API:

/rest/api/2/workflowscheme/{id}
使用此HTTP get请求也将获得返回的XML或JSON工作流信息

这就是你想要的。
/rest/projectconfig/1/workflowscheme/{projectdorkey}

最新Jira文档提供了有关API的信息,这些API可用于获取issuetype方案和工作流方案的详细信息。以下是可用于相同目的的API

  • 获取项目的问题类型方案
  • RESTURL:
    GEThttps://your-domain.atlassian.com/rest/api/2/issuetypescheme/project?projectId={projectId}'

    样本响应:

    {
        "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"
                ]
            }
        ]
    }
    
    {
      "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"
    }
    
  • 获取为项目配置的工作流方案
  • RESTURL:
    GEThttps://your-domain.atlassian.com/rest/api/2/workflowscheme/{id}

    样本响应:

    {
        "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"
                ]
            }
        ]
    }
    
    {
      "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"
    }
    

    这看起来是一个很好的解决方案。唯一的问题是您使用的是Java集成库。我想使用纯REST方法。