Zoho Desk Attachments to Zoho WorkDrive

Zoho Desk Attachments to Zoho WorkDrive

Hi,
I have a requirement to upload attachments to WorkDrive when threads are created in Desk tickets.  I have a custom function correctly identifying the attachment URLs (which I am able to open in a browser) and am trying to use these URLs to upload to WorkDrive.  I am successfully connecting to the API but get a response:
  1. {"id":"F000","title":"LESS_THAN_MIN_OCCURANCE"}
Here is my code snippet:
  1. fileName = attachment.get("name");
  2.     fileUrl = attachment.get("href") + "?orgId=" + ORGID;
  3. stringURL = "https://www.zohoapis.com/workdrive/api/v1/upload";
  4. uploadMap = Map();
  5. uploadMap.put("parent_id","<FOLDER ID IS HERE>");
  6. uploadMap.put("content",fileUrl);
  7. uploadMap.put("filename",fileName);
  8. attributesMap = Map();
  9. attributesMap.put("attributes",uploadMap);
  10. attributesMap.put("type","files");
  11. dataMap = Map();
  12. dataMap.put("data",attributesMap);
  13. parameters = dataMap.toString();
  14. info parameters;
  15. mp = Map();
  16. mp.put("Accept","application/vnd.api+json");
  17. response = invokeurl
  18. [
  19. url : stringURL
  20. type : POST
  21. parameters:parameters
  22. headers: mp
  23. connection: "zworkdrive"
  24. ];
  25. info response;
Any idea what I am doing wrong or even if this is possible?  Does the file need to be local or can it be via a URL as per my requirement?

Thanks!

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Ask the Experts: Five-hour live Q&A session with Zoho WorkDrive product experts

                                                Hello all, We are excited to host the Ask the Experts session on July 18, 2024 between 2:00 PM – 7:00 PM IST. Whether you're just starting to use Zoho WorkDrive, or if you've been with us for a while, this session is an amazing opportunity to discuss
                                              • WorkDrive API Documentation

                                                WorkDrive provides users and developers an extensive set of APIs to help integrate functionalities of Zoho WorkDrive with other Zoho applications and third-party tools. We have published the official WorkDrive API Documentation page for all external users.
                                              • March 15, 2023: Zoho Docs is discontinued

                                                As of today (March 15, 2023) Zoho Docs is discontinued for all users. We would like to thank our customers for trusting us for so many years! Going forward, we're confident you'll enjoy using Zoho WorkDrive for all your advanced file management and collaboration
                                              • Support for auto-upgrade in TrueSync (for Windows)

                                                WorkDrive TrueSync app now supports auto-upgrading to the latest version for Windows OS. You must manually download and install the TrueSync app version 3.4.0 to avail this feature. Download the latest TrueSync app for Windows (version 3.4.0) Supported
                                              • Introducing Collections

                                                Create collection links to easily request any number of users to upload files to a particular folder. Once users upload their files, you will be able to view their submissions and manage their files effortlessly. Users don't need a WorkDrive account to


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now