Fileupload through API in c#

Fileupload through API in c#

Hi

Using the below code for uplaoding a file through API in c#. Getting the error : Invalid URL!!.
Have given the correct url mentioned in zoho api ( https://www.zoho.com/docs/zoho-docs-api.html#upload).
Please let me know what correction is required to upload a file successfully.


public async Task<string> UploadFile()
        {
            var retunVal = "";
            using (HttpClient httpClient = new HttpClient())
            {
                using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, @" https://apidocs.zoho.com/files/v1/upload?authtoken=ed4eef708508749dcd63f38b730abcde&scope=docsapi"))
                {
                    request.Properties.Add("filename", "Untitled.jpg");
                    using (FileStream fstream = File.Open(@"C:\Users\jharikrishna\Desktop\Untitled.jpg", FileMode.Open))
                    {
                        request.Properties.Add("content", fstream);

                        retunVal = await (await httpClient.SendAsync(request)).Content.ReadAsStringAsync();
                    }
                }
            }

            return retunVal;
        }


Note:  Have also tried tried passing bytearray instead of stream for the content parameter value. The result is the same.

      • Sticky Posts

      • Zoho Office Integrator: Moving to the all-new Zoho Sheet

        We introduced the latest version of Zoho Sheet—Sheet 5—in early 2019. This new version consists of a new user interface, improved performance, and an array of useful features. As a part of this, we will upgrade our Remote API integrations to the new version's editor interface on February 29, 2020. Update: The remote API integrations upgrade to the new version's interface will be done on April 15, 2020. Here are some exciting enhancements the new version of Sheet offers for our API users: An AI-powered
      • Businesses prefer Zoho Office Integrator over Microsoft WOPI - Here's why

        Businesses often have difficult decisions to make when building web applications that provide document management capabilities for their users. For example, what's the best solution to integrate with online office editors— Zoho Office Integrator or Microsoft