1

I need to delete the node property in alfresco 5.0.d version. While trying to delete I am getting this below error:

Web Script Status 405 - Method Not Allowed

The alfresco webscript file:

function main() {
  // Get the username 
  var userName = url.extension;
  // Get the agencycode
  var agencycode = args.agencycode;

  var path = '+PATH:"/app:company_home/*"';
  var cond = 'AND (TYPE:"cm:content")';
  var query = path + " " + cond;
  // get all nodes and properties
  var nodes = search.luceneSearch(query);
  logger.system.out(nodes);

  for each(var node in nodes)
  {
    * *// TODO checking the user exists**    

    if (node.properties["agency:agencyname"].indexOf(agencycode) != -1) {
      delete node.properties["agency:agencycode"];
      delete node.properties["agency:agencyname"];
      delete node.properties["agency:createDate"];
    }
  }

  model.success = true;
}

main();

In above script I'm getting the agency code and I'm iterating to check if the agency code matches, then I am deleting the node property.

Please help to resolve from this issue.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
vicky
  • 19
  • 5
  • Can you post your webscript descriptor file? And have you ensured you've registered it for the same HTTP method as you're calling? – Gagravarr Mar 23 '16 at 17:38
  • Deleting the node Property <![CDATA[ Deleting the node and properties for given agencycode
    agencycode
    mandatory - agencycode
    ]]>
    /api/customagencydelete argument admin required limited_support
    – vicky Mar 23 '16 at 23:02
  • 1
    What filename have you given that though? – Gagravarr Mar 23 '16 at 23:11

1 Answers1

2

You are requesting your webscript using a deferent method than the one defined by the naming of your webscript artifacts :

<name>.<method>.<extension>

Note that the method used in that name pattern should be the one using while accessing the webscript! (get, post, put, delete...)

Younes Regaieg
  • 4,156
  • 2
  • 21
  • 37
  • Also if that is a webscript with DELETE method and if you try to call the webscript from browser it will give a response of 405, as the browser by default calls GET. Try calling those webscripts with some REST client such as POSTMAN (addon for chrome). – Sujay Pillai Mar 28 '16 at 07:27