Query: Select all cmis:document
.
SELECT * FROM cmis:document
You need to enable query support by following CMIS Add-on configuration section.
That simple query can be executed by curl as follows:
Upload a text file test.txt
to the drive Collaboration in Sites Explorer.
Send the GET request to query service by curl:
curl -o result.xml -uroot:gtn http://localhost:8080/rest/private/cmisatom/Collaboration/query?q=SELECT%20*%20FROM%20cmis:document
The output file (result.xml
) contains an entry of test.txt:
<feed> ... <cmisra:numItems>1</cmisra:numItems> <entry> <id>058a68ab7f00000101699284020aa88c</id> ... <title type="text">test.txt</title> ... </entry> ... </feed>
If you want to use POST request, write your query in an xml file (cmis:statement
is required):
<?xml version='1.0' encoding='utf-8'?>
<cmis:query xmlns='http://www.w3.org/2005/Atom' xmlns:cmis='http://docs.oasis-open.org/ns/cmis/core/200908/'>
<cmis:statement>SELECT * FROM cmis:document</cmis:statement>
<cmis:maxItems>10</cmis:maxItems>
<cmis:skipCount>0</cmis:skipCount>
<cmis:searchAllVersions>true</cmis:searchAllVersions>
<cmis:includeAllowableActions>true</cmis:includeAllowableActions>
</cmis:query>
Then send it by the following command (for example you saved the file as query.xml
):
curl -o result.xml -X POST -uroot:gtn http://localhost:8080/rest/private/cmisatom/Collaboration/query -H "Content-Type: text/xml; charset=UTF-8" -d @query.xml