Data source not found during HTTP API update

I am trying to update datasource’s password.

  1. First i need to find out its UID:

request = "/api/datasources/name/“influxDB-projectNameToChange”
response:

{
    "id": 372,
    "uid": "ufH01LSVz",
    "orgId": 36,
    "name": "influxDB-projectNameToChange",
    "type": "influxdb",
    "typeLogoUrl": "",
    "access": "proxy",
    "url": "<url>",
    "password": "",
    "user": "",
    "database": "projectNameToChange",
    "basicAuth": true,
    "basicAuthUser": "projectUser_projectNameToChange_grafana",
    "basicAuthPassword": "",
    "withCredentials": false,
    "isDefault": false,
    "jsonData": {},
    "secureJsonFields": {
        "basicAuthPassword": true
    },
    "version": 13,
    "readOnly": false
}
  1. now i have UID and try to change the password:

request = /api/datasources/uid/ufH01LSVz
body =

{
  "id":372,
  "uid":"ufH01LSVz",
  "orgId":36,
  "name":"influxDB-projectNameToChange",
  "type":"influxdb",
  "access":"proxy",
  "url":"<url>",
  "password":"",
  "user":"",
  "database":"projectNameToChange",
  "basicAuth":true,
  "basicAuthUser":"projectUser_projectNameToChange_grafana",
  "secureJsonData": {
    "basicAuthPassword": "changed_password"
  },
  "isDefault":false,
  "jsonData":null,
  "version":13
}

But all i get is error message:

{
    "message": "Not found"
}

The request is copy pasted from docs( Data source HTTP API | Grafana documentation ) yet it does not work. What is wrong with this request? Is there some bug? Is there anything wrong? How can i change the password then when it cannot find datasource using put?

Thanks for help

You didn’t provide reproducible example, so my answer is only a gues:

  • you have old Grafana, which doesn’t have this API
  • you didn’t use PUT method
  • you may try to increase version field