API
Version 7.x > API > REST - URL filtering syntax View modes: 
User avatar
Member
Member
yazid.azahari-bagnetworks.com - 3/11/2013 10:53:45 PM
   
REST - URL filtering syntax
I'm currently running Kentico v7.0.17.

When I try to pull out only PDFs, I can run the following:
http://kenticourl/rest/content/site/kenticositename/en-us/all/?where=documenttype='.pdf'

Can anyone tell me how to format the URL if I'd like to extract .PDF and .DOC files only?

I've tried to limit the results using the "Allowed document types" field under Settings > Integration > REST in the Site Manager, but that doesn't work (or if it does, someone needs to tell me how to do it properly).

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 3/15/2013 9:08:52 PM
   
RE:REST - URL filtering syntax
Hello,

Adding some results from our email discussion.
The CMS.File documents have the file extension stored in the DocumentExtensions field, you can use two parameters, classnames for "cms.file" and where condition with actual file extensions filtering.

Following REST query works for me in testing setup with sample Corporate site to select png and gif files:
~/rest/content/site/corporatesite/en-us/childrenof?classnames=cms.file&where=documentextensions%20IN%20(%27.gif%27,%27.png%27)

The childrenof expression helps to avoid /all, although in case of specified site and document query, you should be able to use /all even for non-admins. Classnames parameter then helps to narrow the search in the specified document types only. You can separate multiple classnames by comma.

Hope this will help.

Regards,
Zdenek