How to get names of content types for search REST API?

For example, I need all list types like this 

type:wiki type:forum type:comment type:file type:blog
How can I get a list of all of these types?
  • The search 'type' pre-dates the content model (i.e. Container, Application, and Content Types) introduced in 7.0. As such, they're not particularly extensible, and may not reflect all the types included out of the box, nor ones that can be installed as custom types. 

    If you can, use content type GUIDs (as defined by the content model) instead. The search API accepts them as well within its Filters parameter in the format: "contenttypeid::(f7d226ab-d59f-475c-9d22-4a79e3f0ec07 OR 46448885-d0e6-4133-bbfb-f0cd7b0fd6f7)". Since they're extensible, the available content types can vary based on community.

    One way to list all currently-searchable content types in your community is to write a quick Velocity script. You can run this in a widget or directly within the script console.

    <ul>
    #foreach($contentType in $core_v2_contentType.List())
        #if ($core_v2_searchResult.IsSearchable($contentType.Id))
            <li>$contentType.Name: $contentType.Id</li>
        #end
    #end
    </ul>

  • Can I then use Filters like this?

    jQuery.telligent.evolution.get({
    	url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/search.json',
    	data: {
    		Filters: 'group::51 AND contenttypeid::46448885-d0e6-4133-bbfb-f0cd7b0fd6f7'
    	},
    	success: function(response) {
         
    	}
    });

  • Close. For that it would be:

    Filters: 'group::51||contenttypeid::46448885-d0e6-4133-bbfb-f0cd7b0fd6f7'

    As with your other question, if you're only filtering by a single group or content type, filter syntax can be complicated and unnecessary. However, with filters, you can combine multiple groups and content types, like:

    jQuery.telligent.evolution.get({
        url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/search.json',
        data: {
            Query:  'theme',
            Filters: 'group::1773,1973||contenttypeid::(f7d226ab-d59f-475c-9d22-4a79e3f0ec07 OR 46448885-d0e6-4133-bbfb-f0cd7b0fd6f7)'
        }
    })

    ... where this searches for "theme" in two groups, restricting to blog posts and forum threads.