Deluge function for merge and sign with CRM

Deluge function for merge and sign with CRM

I have written a function to automatically email out doc based on a template I created in writer with a request to sign. This works fine. However, I the template has a number of merge fields so i also need to pass in the data for the merge fields in my function. I cannot for the life of me find the correct API documentation for this. I have tried

fieldTextData = Map();
fieldTextData.put("TextField_1", "Document to Review");
actionMap.put("field_data",{"field_text_data":fieldTextData});

or

inputMap = Map();
inputMap.put("a_marge_field_api:name","value");

then I am using
response = zoho.writer.signDocument("xxxxx","zohosign", email, "Signed Document", inputMap, "connection");

OR

 mergesign = invokeurl
    [
        url :"https://writer.zoho.com/api/v1/documents/xxxxx/merge/sign"
        type :POST
        parameters:mp
        connection:"connection"
    ];

Either gives me errors of incorrect parameters or oauth problems. For oauth problems I have ticked any possible writer and sign scope, so I doubt it's that. Anyone got this working succesfully?