alfrescoalfresco-share

Search for files in Alfresco based on the content model properties using Rest API


I'm trying to implement searching of files in Alfresco based on the properties of the content model of the document.

I found this ReST API:

GET /alfresco/s/slingshot/search?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?}

But I'm not sure how to pass the property name of the document in the query parameter.

For ex:

My docuemt content model is: dc:InvoiceModel

Property name is: dc:doctype.

So, I want to pass the dc:doctype as query parameter as Sales Invoice for example to fetch all the documents of the type Sales Invoice. The documents are inside a folder in the documentLibrary

I tried doing this:

http://localhost:8080/alfresco/s/slingshot/search?container=documentLibrary/newfolder&sort=dc:dc:doc...false&repo=true&startIndex=0&query={"dc:doctype":"Sales Invoice","datatype":"d:text"}

But I'm getting zero records found. Could you please help me do this.

Alfresco Version:

Alfresco Share v5.1.f (r125711-b6, Aikau 1.0.63, Spring Surf 5.1.f, Spring WebScripts 6.5, Freemarker 2.3.20-alfresco-patched, Rhino 1.7R4-alfresco-patched, Yui 2.9.0-alfresco-20141223)

Alfresco Community v5.1.0 (r127059-b7) schema 10001

Thank you all!


Solution

  • be careful: slingshot is not a public API (but in 5.1 you don't have a public search API). In 5.2 you should use the Alfresco Content Services REST API

    In this SO question you should already find you answer: Passing multiple search arguments to Alfresco slingshot search Webscript

    some remarks: