Grafana Update Datasource

  • What Grafana version and what operating system are you using?
    V8.3.5

  • What are you trying to achieve?
    Trying to make a PUT request to update the existing grafana datasource with UID and the json file in GO.

  • How are you trying to achieve it?
    put_req, reqerr := http.NewRequest(“PUT”, fmt.Sprintf(“%s/api/datasources/%s”, GRAFANA_URL,uid), bytes.NewBuffer(jsonBytes))

  • What happened?
    Got the response and couldnot update the datasource
    response:
    {“message”:“Datasource has already been updated by someone else. Please reload and try again”}

  • What did you expect to happen?
    To update the datasource.

  • Can you copy/paste the configuration(s) that you are having problems with?
    Structure defining the datasource:
    type ESDataSource struct {
    UID string json:"uid"
    Name string json:"name"
    Type string json:"type"
    URL string json:"url"
    Access string json:"access"
    Database string json:"database"
    JsonData ESDataSourceJsonData json:"jsonData"
    }

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    {“message”:“Datasource has already been updated by someone else. Please reload and try again”}

  • Did you follow any online instructions? If so, what is the URL?