Create Datasource Via API

  • What Grafana version and what operating system are you using?
    9.7.7 in ubuntu 22
  • What are you trying to achieve?
    Copy the datasource obtained with a get and create the datasource with a post in a different grafana with the previous obtained data
  • How are you trying to achieve it?
    GET/POST via postman
  • What happened?
    bad request data
  • What did you expect to happen?
    create a datasource
  • Can you copy/paste the configuration(s) that you are having problems with?
    [{“id”:1,“uid”:“Oy1lzRPVk”,“orgId”:1,“name”:“InfluxDB”,“type”:“influxdb”,“typeName”:“InfluxDB”,“typeLogoUrl”:“public/app/plugins/datasource/influxdb/img/influxdb_logo.svg”,“access”:“proxy”,“url”:“http://localhost:8086”,“user”:“myUser”,“database”:“myDb”,“basicAuth”:false,“isDefault”:true,“jsonData”:{},“readOnly”:false}]
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    {“message”:“bad request data”,“traceID”:“”}
  • Did you follow any online instructions? If so, what is the URL?
    Data source HTTP API | Grafana documentation

You are not supposed to provide id with your create request. Instead, the server will assign an id and you will get it back in the response.

Thanks for the fast reply, but i already try without the id.

that is my last POST and gives me the same bad request, 400 {“name”:“InfluxDB”,“type”:“influxdb”,“typeName”:“InfluxDB”,“typeLogoUrl”:“public/app/plugins/datasource/influxdb/img/influxdb_logo.svg”,“access”:“proxy”,“url”:“http://localhost:8086”,“user”:“USER”,“database”:“DATABASE”,“basicAuth”:false,“isDefault”:true,“jsonData”:{},“readOnly”:false}