# Update a User Recipe

Use the `updateMyRecipe` mutation to update your own recipe.  All the arguments to be sent are optional; however, it will update only the ones send in the mutation. Note that only the owner of the recipe can update it.

### Required Arguments

| **Name** | **Type** |                                                                                     **Description**                                                                                    |
| :------: | :------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|   `ID`   |  String  | Unique Id of the user's recipe.  Get the information of all your recipes by executing the [`myRecipes`](https://docs.suggestic.com/graphql/query/queries/recipes/users-recipes) query. |
|  `Input` |  Object  |                                             At least one argument must be sent. See [the list ](#available-arguments)of available arguments                                            |

### Available Arguments

<table data-header-hidden><thead><tr><th width="263">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>name</code></td><td>String</td><td>Name of the recipe</td></tr><tr><td><code>courses</code></td><td>String</td><td>Tags representing the courses associated with the recipe. For example Main dishes, Side Dishes, Appetizers, Salads, etc.</td></tr><tr><td><code>cuisines</code></td><td>String</td><td>Tags representing the cuisines associated with the recipe.</td></tr><tr><td><code>ingredientLines</code></td><td>String</td><td>Description of the recipe ingredients. Separate them by using commas. </td></tr><tr><td><code>ingredients</code></td><td><a href="https://docs.suggestic.com/graphql/objects/food-logs/ingredient-amount">IngredientAmount</a></td><td>An object that includes the ingredient amount for a given food.</td></tr><tr><td><code>instructions</code></td><td>String</td><td>An array of cooking instruction lines. </td></tr><tr><td><code>mealTimes</code></td><td><a href="https://docs.suggestic.com/graphql/objects/common/meal-times">mealTimes</a></td><td>Description of the food</td></tr><tr><td><code>numberOfServings</code></td><td>Int</td><td>Original recipe number of servings</td></tr><tr><td><code>language</code></td><td>Language</td><td><p>Language code of the recipe. Possible Values: </p><ul><li><strong>ES: Spanish</strong></li><li><strong>EN: English</strong></li></ul></td></tr><tr><td><code>tags</code></td><td>String</td><td>Meal tags. Possible values: "VEGETARIAN", "Shake", "PLANT_BASED", "DAIRY_FREE", "VEGAN", "GLUTEN_FREE"</td></tr><tr><td><code>totalTime</code></td><td>String</td><td><p>Total preparation and cooking time in text format</p><p>E.g., 5 minutes</p></td></tr><tr><td><code>totalTimeInSeconds</code></td><td>Int</td><td>Total preparation and cooking time in seconds</td></tr></tbody></table>

### Available Fields

The following field will be part of the response.

| **Field name** | **Type** | **Description**                                                                  |
| -------------- | -------- | -------------------------------------------------------------------------------- |
| `sucess`       | String   | **True** if the user's recipe has been updated. Otherwise, it displays **False** |
| `message`      | String   | Description of the result                                                        |

## Example

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

```graphql
mutation updateMyRecipe {
  updateMyRecipe(id:"VXNlclJlY2lwZTphNXNKWVh3QlY0Q1V6aWdSNkhaeg==" 
    input: {
      name: "Fried Chicken"
      tags: ["fried", "chicken"]
      cuisines:"American"
      courses: "Main Dish"
    }
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "updateMyRecipe": {
      "success": true,
      "message": "My recipe was updated"
    }
  }
}
```

{% endtab %}
{% endtabs %}

Execute the [`myRecipe`](https://docs.suggestic.com/graphql/query/queries/food-log/users-recipes) query to check if the information was updated successfully:

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

```graphql
query {
  myRecipes (id:"VXNlclJlY2lwZTphNXNKWVh3QlY0Q1V6aWdSNkhaeg=="){
    edges {
      node {
        id
        name
        tags
        ingredientLines
        numberOfServings
        instructions
        mealTimes
        courses
        cuisines

      }
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "myRecipes": {
      "edges": [
        {
          "node": {
            "id": "VXNlclJlY2lwZTphNXNKWVh3QlY0Q1V6aWdSNkhaeg==",
            "name": "Fried Chicken",
            "tags": [
              "fried",
              "chicken"
            ],
            "ingredientLines": [
              "Line1",
              "Line2"
            ],
            "numberOfServings": 2,
            "instructions": "In a large bowl, beat the eggs. In another bowl, combine the salt, pepper, garlic powder and paprika to make a seasoned salt. Add the flour to a third bowl.",
            "mealTimes": [
              "DINNER",
              "LUNCH"
            ],
            "courses": [
              "Main Dish"
            ],
            "cuisines": [
              "American"
            ]
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}
