# Water and Hydration

Use the `hydration` query to get the information on the daily water intake based on a start and end date.

{% hint style="info" %}
The [*updateHydration*](https://docs.suggestic.com/graphql/query/mutations/update-hydratation) mutation must be executed before getting the water intake information.&#x20;
{% endhint %}

{% hint style="warning" %}
**Note:** Currently tracking service only supports [JWT authentication](https://docs.suggestic.com/graphql/graphql/authentication#jwt-authentication)
{% endhint %}

### **Required Arguments**

| Argument    | Type | Note                                                                              |
| ----------- | ---- | --------------------------------------------------------------------------------- |
| `startDate` | Date | The date when the water entries will start counting. Use the format: `YYYY-MM-DD` |
| `endDate`   | Date | The date when the water entries will end counting. Use the format: `YYYY-MM-DD`   |

### **Available Fields**

<table data-header-hidden><thead><tr><th width="299.3333333333333">Field</th><th>Type</th><th>Note</th></tr></thead><tbody><tr><td>Field</td><td>Type</td><td>Note</td></tr><tr><td><code>isToday</code></td><td>Boolean</td><td><strong>True</strong> if it is today's date; otherwise, it will display the <strong>False</strong> value</td></tr><tr><td><code>quantity</code></td><td>Float</td><td>Number of cups of water to intake</td></tr><tr><td><code>date</code></td><td>Date</td><td>The date when 1 cup of water has been logged. Use the format: <code>YYYY-MM-DD</code> </td></tr><tr><td><code>goal</code></td><td>Float</td><td>The number of cups of water to be intake. The default goal to be defined is 8 cups of water.</td></tr></tbody></table>

### Example <a href="#example" id="example"></a>

#### GraphQL Example

{% tabs %}
{% tab title="Query" %}

```javascript
{
  hydration(
    startDate: "2020-10-06"
    endDate: "2020-10-13") 
  {
    isToday
    quantity
    date
    goal
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "hydration": [
      {
        "isToday": false,
        "date": "2020-10-14",
        "quantity": 4,
        "goal": 8
      },
      {
        "isToday": true,
        "date": "2020-10-13",
        "quantity": 4,
        "goal": 8
      },
      {
        "isToday": false,
        "date": "2020-10-12",
        "quantity": 8,
        "goal": 8
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

#### curl Example

{% tabs %}
{% tab title="Request" %}

```javascript
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
 --data-raw '{"query": "query { hydration(startDate:\"2020-10-13\", endDate:\"2021-05-10\") { isToday quantity date goal }}"}'
}'
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "data": {
        "hydration": [
            {
                "isToday": false,
                "quantity": 4,
                "date": "2020-10-13",
                "goal": 8
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}
