# InfluxDB Read Query Action

It provides a way to run InfluxDB Query. Before adding InfluxDB Read Action, user has to define a [**InfluxDB Connection**](https://docs.thingsup.io/connections/influxdb-connection)**.** User need to provide following parameters to add InfluxDB Read Query Action.

#### Function

* User can JavaScript code to create dynamic query.
* Here the "payload" object and "Query" String object available in the code which is directly executed on InfluxDB Connection.
* "payload" object is supplied from Action Trigger like Rules, Action Command etc.

```
//Example 1

Query = "select Count(Result) from MY_MEASUREMENT WHERE time > now() - 24h GROUP BY time(30m) order by time desc"
```

```
//Example 2

Query = `SELECT * FROM "ienergyDigital" WHERE "Current" = 4.17`
```

#### Connection ID

User need to provide Connection ID of InfluxDB database connection.

![Add InfluxDB Read Query](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2F7NxqqSNlwrSMwOEEskQO%2FinfluxDBRead.png?alt=media\&token=c9f48ecd-967d-4ee6-8f79-9495f94e595b)

Please note the following points:

{% hint style="info" %}

* "payload" object is supplied from Action Trigger like Rules, Action Command etc.
* Data Response of InfluxDB query will be available as Action Response.
  {% endhint %}
