What is syntax to change external link permissions from Edit to View?

What is syntax to change external link permissions from Edit to View?

I need to change permissions on an external share link from Edit to View. 

Here is my code to create the external share link with edit rights.

How to modify it to change to view-only rights?


  1. // Create External Share Link
  2. mp = Map();
  3. mp.put("Accept","application/vnd.api+json");
  4. //Parameters Map
  5. externalLinkMap = Map();
  6. externalLinkMap.put("resource_id",resource_id);
  7. externalLinkMap.put("link_name","link");
  8. externalLinkMap.put("request_user_data",false);
  9. externalLinkMap.put("allow_download",false);

  10. // Give editor access
  11. externalLinkMap.put("role_id","5");
  12. attributesMap = {"attributes":externalLinkMap,"type":"links"};
  13. dataMap = Map();
  14. dataMap.put("data",attributesMap);

  15. createExternalLink = invokeurl
  16. [
  17. url :"https://workdrive.zoho.com/api/v1/links"
  18. type :POST
  19. parameters:dataMap.toString()
  20. headers:mp
  21. connection:"workdrive_all"
  22. ];