I'm trying to make a post request which has three parameters out of with two are string but the third one is a file that needs to be uploaded. I tried the following code but doesn't work.. It will provide some overview.
using System;
namespace WorkDrive
{
class Program
{
static void Main(string[] args)
{
string AuthToken = "xxxxxxxxxxxxxxxxxxxxxx";
string url = string.Format("https://apidocs.zoho.com/files/v1/upload?authtoken=" + AuthToken + "&scope=docsapi"");
string FolderID = "xxxxxxxxxxxxxx";
string fileName = "a.xls";
var client = new RestClient(url);
var request = new RestRequest();
request.AddParameter("fid", FolderID);
request.AddParameter("filename", fileName);
request.AddFile("content", "Path to File\\a.xls");
var response = client.Post(request);
var content = response.Content; // raw content as string
Console.WriteLine(content);
Console.ReadLine();
}
}
}