What is the API call to create external sharelink for a pdf

What is the API call to create external sharelink for a pdf

Here's my code

  1.         mp = Map();
  2. mp.put("Accept","application/vnd.api+json");
  3. // Parameters Map
  4. externalLinkMap = Map();
  5. externalLinkMap.put("resource_id",resource_id);
  6. externalLinkMap.put("link_name","link");
  7. externalLinkMap.put("request_user_data",false);
  8. externalLinkMap.put("allow_download",true);
  9. // Give view-only access
  10. externalLinkMap.put("role_id","34");
  11. attributesMap = {"attributes":externalLinkMap,"type":"links"};
  12. dataMap = Map();
  13. dataMap.put("data",attributesMap);
  14. // Create external share link
  15. external_link_data = invokeurl
  16. [
  17. url :"https://www.zohoapis.com/workdrive/api/v1/links"
  18. type :POST
  19. parameters:dataMap.toString()
  20. headers:mp
  21. connection:"workdrive_all"
  22. ];
The connection has the correct scope(s).

The error message is 
  1. {"errors":[{"id":"R008","title":"Unauthorized access"}]}
I know the code works for native Zoho document types such as a sheet.


    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


                                              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