cancel
Showing results for 
Search instead for 
Did you mean: 

Call the Audit query webscript from a js file in the repo

kavilash23
Champ on-the-rise
Champ on-the-rise
Hi Guys,

I am currently working on an auditing report and having issues when calling the Audit query webscript (http://localhost:8080/alfresco/service/api/audit/query/AuditExampleLogin2) from a javascript file in the repo.

I have tried the following after enabling the 'remote' object for alfresco (its enabled only for share OOTB)
  
   var url = "http://localhost:8080/alfresco/service/api/audit/query/AuditExampleLogin2?verbose=true"
   var theUrl = "/api/audit/query/AuditExampleLogin2?verbose=true";
   var json = remote.call(theUrl);
   //var connector = remote.connect("http");
   //var json = connector.call(url);
   logger.log(json);

but the returned json is complaining about authentication

{ "status" : { "code" : 401, "name" : "Unauthorized", "description" : "The request requires HTTP authentication." }, "message" : "07200002 Authentication failed for Web Script org\/alfresco\/repository\/audit\/query.get", "exception" : "org.springframework.extensions.webscripts.WebScriptException - 07200002 Authentication failed for Web Script org\/alfresco\/repository\/audit\/query.get",

Can anyone please advice?

Kind Regards,

Kavi
2 REPLIES 2

romschn
Star Collaborator
Star Collaborator
You should also pass the alf_ticket for admin user while invoking the audit webscript.

Hope this helps.

Thanks ramesh you were very helpfull