【问题标题】:Getting 401 unauthorized when attempting to update custom measure through API尝试通过 API 更新自定义度量时获得 401 未授权
【发布时间】:2018-03-16 19:34:45
【问题描述】:

因此,我创建了一个名为“test_count”的自定义指标,并将其作为自定义指标添加到项目中。我可以用 REST 查询度量

GET /api/custom_measures/search

给定 projectKey 作为参数和 f=metric,我得到

{
  "customMeasures": [
    {
      "id": "1",
      "metric": {
        "id": "145",
        "key": "test_count",
        "type": "INT",
        "name": "Test Count",
        "domain": "Coverage"
      }
    }
  ],
  "total": 1,
  "p": 1,
  "ps": 100
}

到目前为止一切顺利。请注意,在此之前我已通过/api/authentication 授权自己。

现在我想更新这个自定义度量。我发布到以下

POST /api/custom_measures/update

给定 id 和 value 作为参数。但我得到 401。我尝试使用 id 1145,但都返回 401。不用说,测量没有通过。

我做错了什么?

【问题讨论】:

    标签: sonarqube


    【解决方案1】:

    您需要发送您的凭据 POST。

    【讨论】:

    • 试过 sonar-gw/api/custom_measures/update?id=1&value=2&login=admin&password=admin (是的,我没有更改管理员凭据,不要评判我),但仍然不行.请注意 POST 到 sonar-gw/api/authentication/login?login=admin&password=admin 返回 200 OK
    猜你喜欢
    • 2019-01-18
    • 1970-01-01
    • 2020-08-08
    • 1970-01-01
    • 2022-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-29
    相关资源
    最近更新 更多