I’m trying to test requests made to the Monday.com files API, and so far, I can’t any queries to successfully go through. I keep getting a 400: Unsupported query with all my attempts.
And here’s the full query in text: mutation ($file: File!) { add_file_to_column (file: $file, item_id: 8..., column_id: "files") { id } }
Yet when I run that (and any variations I can think of), I get the following response:
Also, for what it’s worth, I’m 100% sure that an item with the specified ID exists in our Monday.com system. I’m also sure that the Authorization token is fine because I’ve been using it to make valid requests to the regular Monday.com API.
Can anyone please point out what I’m doing wrong? Thank you.
For what it’s worth, I was able to get this to work by manually assembling the POST data in PHP with POST multipart/form-data boundaries and cURL. It wasn’t fun, but it worked.
What I can’t understand is why that method worked, but posting from Postman with the exact same data doesn’t and also trying to use Guzzle in Laravel with the same parameters didn’t work. Very strange.
I’m probably overlooking something obvious, but for anyone else using PHP that gets stuck, try manually assembling the POST fields with cURL to send the file request.
Good luck! And let’s hope that the Monday.com API team makes this easier in the future (without breaking the currently working method) for all of our sakes.
Is there a missing permission somewhere that could explain this?
In the account there is an option for that :
https://YOUR_ACCOUNT_NAME.monday.com/admin/permissions/permissions
Perhaps permissions are an issue, but I’m not sure how they could be if the token works for other API requests and I was able to use the token for the files by manually assembling the POST data in PHP.
Thanks for the reply, Daniel. I legitimately don’t know either. I cut it off in the screenshot, but I was attempting form-data and the variables[file] key was definitely set to an actual file. In other words, not sure why it didn’t work for me.
No, sadly, Daniel, it’s still not working. I tried exactly what you said, and I get an unsupported query error. Here’s the exact query I’m using (with the item ID removed):
I’m using form-data for the body data type in Postman, I’m posting to the correct URL, I’ve got the variables[file] parameter set to an actual file as you suggested, etc., etc. and it just doesn’t work.
It still works when I manually assemble a cURL query in PHP, but it doesn’t work in Postman. Sorry.
Hey @LOIJon - this is really odd. I’m wondering if perhaps Postman is / isn’t doing something in the headers. Could you send us a screenshot of the full config (with the API key blurred out)?
Hi
I notice that your version of Postman does not have a dedicated GraphQL radio-button for your post data.
Maybe you could try to run the query on a more recent version of Postman that have this feature and see if it helps.
it could be something with the headers, like @dsilva pointed out
Thanks, ellis. While it wasn’t clear in the screenshot, the variables[file] param value is being set via File, not Text. I selected File, and then searched my PC for a random image I wanted to upload. Still doesn’t work. I will try upgrading Postman and see if that matters, but I can’t imagine why it would and I have run out of ideas for why it’s not working for me.