{“error_message”:“Unsupported query”,“status_code”:400}

Hi All

I’m using below code to upload file to monday.com with VB.NET

Dim client2 = New RestClient(“https://api.monday.com/v2/file”)
Dim request2 = New RestRequest(Method.POST)
request2.AddHeader(“Authorization”, “XXXXXXX”)
request2.AddHeader(“Content-Type”, “multipart/form-data”)
request2.AddFile(“variables[file]”, “C:/test.txt”)
request2.AddParameter(“query”, “mutation($file: File!) {add_file_to_column(file: $file,item_id:XXXXXXXX,column_id:”“files”“) {id}}”)
Dim response2 As IRestResponse = client2.Execute(request2)

I received an error {“error_message”:“Unsupported query”,“status_code”:400}

I tried with escape "\ and that gave the same error with VB.NET.

Does anyone have an idea of what’s wrong here?

Din

1 Like

Hey @dinithij ,

monday API is graphQL, hence, your request is either a mutation or a query.
Reading data is “query”, changing data is “mutation”.

In general you can test your queries here:

Greetings

1 Like

Hey @dinithij :wave:

Thank you for reaching out to us with this issue! It does seem like @TMNXT-Dev has a good point and it seems like your query is not declared just yet. Could you please try looking through the suggested steps and see if you can get this to worK?

-Alex

Thanks everyone. I managed to fix my issue. It is due to Rest Client version I had.
Din

1 Like

@dinithij amazing!

For anyone who is wondering about the solution here, you can find a working code example here as well:

How to use add_file_to_column in VB.NET (API Call)

-Alex