How to create password share link via API

How to create password share link via API

My param payload matches exactly as shown in your help docs here: https://writer.zohopublic.com/writer/published/ankqibdb934759c6446bca8899b2f426428fc


What is wrong and why am i getting this error?



  1. //resource ID for file to be shared
    resourceID = '6a3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
    linkName = 'myTestLink';
    expDate = today.addWeek(1);


    param = Map();
    param.put("resource_id",resourceID);
    param.put("link_name",linkName);
    param.put("request_user_data",false);
    param.put("password_text","testPassword1");
    param.put("allow_download",true);
    param.put("expiration_date",expDate);
    param.put("role_id","6");


    attributesMap = Map();
    attributesMap.put("attributes",param);

    mapContainer = Map();
    mapContainer.put("data",attributesMap);

    attributesMap.put("type","links");

    newParams = Map();
    newParams.put("JSONString",mapContainer);

    info newParams;

    createLink = invokeurl
    [
        url :"https://workdrive.zoho.com/api/v1/links"
        type :POST
        parameters:newParams
        connection:"zoho_workdrive_conx"
    ];
    info createLink;


    return "";
Here is response:
  1. {"JSONString":{"data":{"attributes":{"resource_id":"6a3XXXXXXXXXXXXXXXXXXXX","link_name":"myTestLink","request_user_data":false,"password_text":"testPassword1","allow_download":true,"expiration_date":"17-May-2021","role_id":"6"},"type":"links"}}}
  2. {"errors":[{"id":"F000","title":"JSON_PARSE_ERROR"}]}