Mutation fails on upload file with Parse error

Greetings everyone! I’m creating this mutation in Postman to test file upload

mutation {
add_file_to_column (item_id: 'Madalena Vidal', column_id: 'arquivos', $file: File!) {
id
}
}

The answer with the error is this one

{
    "errors": [
        {
            "message": "Parse error on \"'\" (error) at [2, 30]",
            "locations": [
                {
                    "line": 2,
                    "column": 30
                }
            ]
        }
    ],
    "account_id": 6337608
}

your guidance will be highly esteemed by me. Strong hug

Hi @mpaon!

It looks like you’re using a variable to try and add a local file to an item’s file column without defining it.

Where are you storing this file, and how are you passing it via this query?

I’m wondering if you’ve had a chance to check out Alex’s post on uploading files using variables yet? If not, you can find it here.

Take a look and let me know if you have any other questions

Hey @mpaon :wave:

I agree with Helen here! I also couldn’t help but notice you are using an Item ID that seems to be the Item Name:

item_id: ‘Madalena Vidal’

Item IDs will always be an integer value, for example:

item_id: 123456789

I suggest taking a look here to get an overview of how to get Item IDs:

Where to find board, item, and column IDs

I hope this helps :slight_smile:

-Alex

I’ll go to see this Helen and report it

Hey Alex so I use the name of the a person to mod the column and row…
To explain better I get infromation of the person in php form and save in my board into monday. Is 100 person fills the form to be created 100 rows with some columns

I saw this link that explains the node but I didn’t understand it very well because it didn’t work

Hi @mpaon!

Apologies, are you still seeing the same error message? Did you modify your query at all, or are you still using the same one?

To confirm what Alex mentioned, the item_id in this case needs to be a set of numbers (i.e. the ID of the item you’re attempting to add the file to). Same with the column_id, this needs to be the column ID of the file column you’re attempting to add the file to.

Does this make sense? Were you able to check out the resource that Alex shared?

I’ll be clearer… I have this mutation

mutation($myItemName: String!, $columnVals: JSON!){
  create_item (board_id:1079211067, item_name:$myItemName, column_values:$columnVals){
   id
  }
} 

This is my board

How can I add the upload query within this mutation. To create a new item on the board with one or more files inside the column @AlexSavchuk @Helen the columns to files it’s Curriculo and Carta_apresentacao

@mpaon

Thank you for circling back with us here!

I’m afraid that at this time, it is not possible to create an item and upload a file at the same time. I would recommend creating the item, getting the ID of the item that was created to the board, then running a separate mutation that would add the file to the relevant column. Do you think this kind of approach would work?

-Alex

I’ll try this and report to you! thanks a lot to suggestion

1 Like

@mpaon

Sure thing! Let us know how it goes - i’ll be keeping my fingers crossed :slight_smile:

-Alex

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Hi @mpaon!

Since it’s been a while since we last heard from you, I’m going to mark Alex’s last comment as the solution. This thread will proceed to close within 7 days.

If this issue is still persisting for you, feel free to comment on this thread before then or start a new topic.

Thanks!