Strapi GraphQL mutations and nested mutations

Hey folks! I have a GraphQL API for a Strapi-powered backend app, with an “items” table and an “images” table. In the items table there is a column for an optional “imageID” foreign key.

I want to create a mutation for a new item and want to give it an imageID, but the image file should be freshly uploaded with the rest of the item details and doesn’t have an ID yet.

So I’m trying to write the mega-mutation a bit like this, using createItem() and upload()

mutation CREATE_ITEM_MUTATION(
    $name: String!
    $image: Upload
  ) {
    createItem(
      input: {
        data: {
          name: $name
          image: { 
            upload(file: $image){
              id # <======= this is what I need to pass in as the "image" value to createItem
            }
          }
        }
      }
    ) {
      item {
        id
        size
      }
    }
  }

But the GraphQL playground yells at me for a syntax error where I use the upload( above: Expected Name, found (.

So my question is: how do I grab the imageID from the upload method and pass it in to its parent, createItem method? (Is that even possible?)

Pardon me, @sunnyson, @DMehaffy, others, is this possible ? It would be awesome if this is possible.

Short answer: No

Take a look at these useful resources: