AnsweredAssumed Answered

Search through REStful Api

Question asked by lakshya on Jan 27, 2009
Latest reply on Aug 1, 2009 by lakshya
I need to run POST /alfresco/service/api/query

Code I have written for it is :
       URL = "http://localhost:8081/alfresco/service/api/query";
       PostMethod method = new PostMethod(URL);
       String filePath = "query.xml";
       String contentType = "application/atom+xml;type=query"; // tried with "application/cmsrequest+xml;type=query" also

       File upload = new File(filePath);      
       method.setRequestHeader("name", upload.getName());
       method.setRequestHeader("Content-type", contentType);
       method.setRequestBody(new FileInputStream(upload));

and query.xml is:
<?xml version="1.0"?>
<query xmlns="">
    <statement>SELECT * FROM document</statement>

I am getting the following error:
org.alfresco.service.cmr.repository.TemplateException -
Error during processing of the template 'Expression statement is undefined on line 12, column 58 in org/alfresco/repository/search/'. Please contact your system administrator.</td></tr>

Can anyone help me out to get the way for sending query through RESt.