Fileupload not working through API in c#

Fileupload not working through API in c#

Hi, 

Using the below UploadFile function, trying to upload a document. But receiving the error: {"ERROR":"Invalid URL specified !!"}.

What correction is required to upload the document 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=ed4eef708508749dcd63f38b7307xxxx&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;
        }
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      • 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

      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner

                        • Word of the Day

                          Word of the Day


                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner

                        • Word of the Day

                          Word of the Day



                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方