Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Creating an Ingredient

Expand
titleRequest

Mutation

Code Block
languagegraphql
mutation($input : CreateFoodInput!){
    foods{
        create(input:$input)
        {
            food{
                id
                name
                definingAmount{
                    quantity{
                        value
                    }
                    unit{
                        id
                        name
                    }
                }
                conversions{
                    from{
                        quantity{
                            value
                        }
                        unit{
                            id
                            name
                        }
                    }
                    to{
                        quantity{
                            value
                        }
                        unit{
                            id
                            name
                        }
                    }
                }
            }
        }
    }
}

GraphQL Variables

Code Block
languagejson
{
    "input":{
        "name":"Test Ingredient Name",
        "foodType":"Ingredient"
    }
}
Expand
titleResponse
Code Block
languagejson
{
    "data": {
        "foods": {
            "create": {
                "food": {
                    "id": "bd975a4b-5bc0-4e8a-885d-a9c1f586125b",
                    "name": "Test Ingredient Name",
                    "definingAmount": {
                        "quantity": {
                            "value": "100"
                        },
                        "unit": {
                            "id": "a7df0af5-0008-0000-7484-751e8eaf05c6",
                            "name": "Gram"
                        }
                    },
                    "conversions": [
                        {
                            "from": {
                                "quantity": {
                                    "value": "1"
                                },
                                "unit": {
                                    "id": "a7df0af5-0063-0000-7484-751e8eaf05c6",
                                    "name": "Batch Weight"
                                }
                            },
                            "to": {
                                "quantity": {
                                    "value": "100"
                                },
                                "unit": {
                                    "id": "a7df0af5-0008-0000-7484-751e8eaf05c6",
                                    "name": "Gram"
                                }
                            }
                        },
                        {
                            "from": {
                                "quantity": {
                                    "value": "100"
                                },
                                "unit": {
                                    "id": "a7df0af5-0008-0000-7484-751e8eaf05c6",
                                    "name": "Gram"
                                }
                            },
                            "to": {
                                "quantity": {
                                    "value": "1"
                                },
                                "unit": {
                                    "id": "a7df0af5-0064-0000-7484-751e8eaf05c6",
                                    "name": "Batch Yield"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
}

Creating a Recipe

Expand
titleRequest

Mutation

Code Block
mutation($input : CreateFoodInput!){
    foods{
        create(input:$input)
        {
            food{
                id
                name
                }
            }
        }
}

GraphQL Variables

Code Block
{
    "input":{
        "name":"Test Recipe Name",
        "foodType":"Recipe"
    }
}
Expand
titleResponse
Code Block
{
    "data": {
        "foods": {
            "create": {
                "food": {
                    "id": "0f33eb79-7ba1-48eb-acd6-1f8c22858cea",
                    "name": "Test Recipe Name"
                }
            }
        }
    }
}