# Datasource Test using API?

**URL:** <https://community.grafana.com/t/datasource-test-using-api/66770>\
**Category:** Configuration\
**Tags:** datasource\
**Created:** [June 6, 2022, 10:15pm UTC](https://community.grafana.com/t/datasource-test-using-api/66770 "2022-06-06T22:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![waltermercado](https://avatars.discourse-cdn.com/v4/letter/w/a88e57/32.png) [@waltermercado](https://community.grafana.com/u/waltermercado)\
**Post date:** [June 6, 2022, 10:15pm UTC](https://community.grafana.com/t/datasource-test-using-api/66770/1 "2022-06-06T22:15:31Z")

</div>

I created a datasource(InfluxDB) using API with this information

```auto
{
        "name": datasource_name,
        "database": datasource_name,
        "type": "influxdb",
        "access": "proxy",
        "url": "http://qegrafana.net:8086",
        "basicAuth": True,
        "basicAuthUser": '{user}',
        "secureJsonData": {
            "basicAuthPassword": '{password}'
        }
    }

```

also I created a dashboard using the API and with some panels using this datasource but when I edit one of these panels looks like the Datasource was not created correctly. What I need to do is go to datasource settings and click on the Save and Test button of a specific datasource and with this the dashboard panels start to work.

Is there any way to do this(Save and Test) by API instead of doing it manually?

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [July 8, 2022, 9:41pm UTC](https://community.grafana.com/t/datasource-test-using-api/66770/2 "2022-07-08T21:41:28Z")

</div>

what version of grafana are you running? please provide as much detail as possible

---

<div class="post-metadata">

**Author:** ![mzgtootoo](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@mzgtootoo](https://community.grafana.com/u/mzgtootoo)\
**Post date:** [October 1, 2022, 9:06am UTC](https://community.grafana.com/t/datasource-test-using-api/66770/3 "2022-10-01T09:06:25Z")

</div>

Same problem here. Grafana v9.1.2. Adding InfluxDB data source using Grafana API Golang client. The data source is created successfully but cannot be selected in a dashboard panel until I go to data sources settings \> my InfluxDB data source, and click Save & test manually.
