javascript - 用于区分 Jira Cloud 和 Jira Software(本地)的 API
问题描述
我必须使用 REST API 提取所有 Jira 字段。但是,云版本在响应中有“key”关键字,而本地版本没有。
有什么方法可以确定响应是来自本地还是来自云端。
注意:我必须进行多个 Jira API 调用(创建、提取问题等),因此比较“key”关键字对我来说不是解决方案。
来自 Jira 云的示例响应(获取字段时):
[
{
"id": "issuetype",
"name": "Issue Type",
"key" : "issuetype",
"custom": false,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"issuetype",
"type"
],
"schema": {
"type": "issuetype",
"system": "issuetype"
}
}
]
来自 Jira on-prem 的示例响应(获取字段时):
[
{
"id": "issuetype",
"name": "Issue Type",
"custom": false,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"issuetype",
"type"
],
"schema": {
"type": "issuetype",
"system": "issuetype"
}
}
]
是否有任何 API 来区分版本(云或本地)?
解决方案
@mdoar 的解决方案(在评论部分)
“我看到rest/api/latest/serverInfo
资源有一个名为“部署”的键,其值为 Jira 服务器的“服务器”。这可能会有所帮助“
推荐阅读
- elasticsearch - Elasticsearch:模糊查询和过滤结果
- java - Java Concurrent API 的锁未按预期工作
- c# - 无法对上下文菜单选项执行操作
- macos - 如何在按住 Option 键的 macOS 窗口中模拟自动选项卡创建?
- grafana - 为什么 grafana 似乎丢失了 loki 标签信息
- amazon-web-services - 解压缩 S3 中存在的文件并将其上传回 S3
- r - 滚动均方根而不是r中的均值
- php - 按类别进行两次查询
- android - Android UI 测试 Fragment 包含自定义视图
- regex - 正则表达式用 abcDef 整个单词替换 abc_def 避免 R.id.abc_def