# Meal Tracker

Meal Tracker is a simplified version of food logging that only works for meal plan meals.

Use the `mealTracker` query to get the list of all tracked meals for a given range of dates.&#x20;

To obtain the list of tracked meals, it is required to have meal entries created. Refer to [this documentation](https://docs.suggestic.com/graphql/query/mutations/meal-plan/create-a-meal-entry) to create a meal tracker entry.

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

### **Required Arguments**

| Field       | Type | Note                                                                           |
| ----------- | ---- | ------------------------------------------------------------------------------ |
| `startDate` | Date | The date when the meal entry will start counting. Use the format: `YYYY-MM-DD` |
| `endDate`   | Date | The date when the meal entry will end counting. Use the format: `YYYY-MM-DD`   |

### Available Fields

The following fields will be displayed in the response:

| Field    | Type   | Note                                                                                                                                                                                |
| -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mealId` | String | Id of the meal                                                                                                                                                                      |
| `value`  | String | <p>Value of the meal. Possible values:</p><p><code>SKIPPED</code>, <code>ATE</code>, <code>OTHER\_FOLLOWING</code>, <code>OTHER\_NOT\_FOLLOWING</code>, and <code>DELETE</code></p> |
| `date`   | Date   | It contains the date that corresponds to that particular `day` based on the last time a meal plan was generated.                                                                    |

## Examples

### GraphQL Example

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

```graphql
{
 mealTracker(startDate: "2019-10-06" endDate: "2021-10-13") 
  {
    mealId
    value
    date
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "mealTracker": [
      {
        "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpVeU16RTA=",
        "value": "SKIPPED",
        "date": "2021-08-26"
      },
      {
        "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpVeU16RTM=",
        "value": "OTHER_FOLLOWING",
        "date": "2021-08-26"
      },
      {
        "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpRek5EazI=",
        "value": "ATE",
        "date": "2021-08-17"
      },
      {
        "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpRek5EazU=",
        "value": "SKIPPED",
        "date": "2021-08-17"
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

### curl Example

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

```java
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
--data-raw '{"query": "query { mealTracker(startDate:\"2019-10-06\", endDate:\"2021-10-13\") { mealId value date }}"}'
```

{% endtab %}

{% tab title="Response" %}

```java
{
    "data": {
        "mealTracker": [
            {
                "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpVeU16RTA=",
                "value": "SKIPPED",
                "date": "2021-08-26"
            },
            {
                "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpVeU16RTM=",
                "value": "OTHER_FOLLOWING",
                "date": "2021-08-26"
            },
            {
                "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpRek5EazI=",
                "value": "ATE",
                "date": "2021-08-17"
            },
            {
                "mealId": "TWVhbFRyYWNrOlRXVmhiRG94TXpRek5EazU=",
                "value": "SKIPPED",
                "date": "2021-08-17"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.suggestic.com/graphql/query/queries/meal-plan/meal-tracking/meal-tracker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
