I’m using https://api.monday.com/v2 to create items from my VB.NET code. I was managed to do that without any problem. Now I need to upload some files to monday.com using APIs.
I don’t have an example in VB or C# for you sorry as I don’t work with these languages, however you only need to make a POST request to https://api.monday.com/v2/file
You should be able to complete this in the same way that you have created a new item, you simply need to change the endpoint and the variables that you are passing.
To be transparent with you, I do not use VB.net or C# myself, but I will definitely be on the lookout throughout the community to see if there are any helpful resources I could pass here. If I’ll find anything relevant to your request, I’ll reply to this thread
In case you do get this to work using C# and VB.NET, that would be a simply incredible resource to share, if you don’t mind.
Thanks for the input Alex. I still couldn’t make it work. Please share if you find any sample and I will definitely post here if I get this work with C#/VB.NET.
var client = new RestClient(“https://api.monday.com/v2/file”);
var request = new RestRequest(Method.POST);
request.AddHeader(“Authorization”, “XXXXXXXXX”);
request.AddHeader(“Content-Type”, “multipart/form-data”);
request.AddFile(“variables[file]”, “C:/test.txt”);
request.AddParameter(“query”, “mutation($file: File!) {add_file_to_column(file: $file,item_id:XXXXXXX,column_id:"files") {id}}”);
IRestResponse response = client.Execute(request);
When I try to use the same code converted to 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.
Thank you for posting the above examples, I’m sure other community members will find those helpful!
Just to reiterate on the other community post you’ve had about this issue, you will need to properly declare your API request first. I believe that is the issue you are facing here, based on the error code:
I managed to fix my issue. It is due to Rest Client version I had.
So If any one need VB.NET/C# code for add_file_to_column, You can use below code.
C# var client = new RestClient(“https://api.monday.com/v2/file”); var request = new RestRequest(Method.POST); request.AddHeader(“Authorization”, “XXXXXXXXX”); request.AddHeader(“Content-Type”, “multipart/form-data”); request.AddFile(“variables[file]”, “C:/test.txt”); request.AddParameter(“query”, “mutation($file: File!) {add_file_to_column(file: $file,item_id:XXXXXXX,column_id:“files”) {id}}”); IRestResponse response = client.Execute(request);
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)
That is incredible!! Thanks so much for sharing this, I really appreciate it! I am also really glad to hear you were able to figure out the issue here.