Previous Next

Search assets by asset type

get
/resources/v1/search/types/{assetType}/assets
The resource endpoint returns the list of all assets based on a given asset type.
It is a Collection Resource.

The following tables summarize the client request.

Path Parameters
Name Description Format
assetType Asset type string
Query Parameters
Name Description Format
countonly Accepts a Boolean value. Setting it true displays only the count, and no results are returned. The default is false. boolean
field:[fieldname]:[operation] Specify a query condition for a field of [fieldname] with the specified operation. [Operation] is optional and can be one of equals, range, startswith, phrase, wildcard, similar, or contains; the default is contains. For the range operation, the value's format is {lower bound}:{upper bound}; for example, 1:10. string
fields Accepts a comma-separated list of attribute names for each search result. By default only name and description are given for each search result. string
limit Specify the total number of items to be returned. number
links Accepts a comma-separated list of link names. By default, this parameter gives all the links (next, prev, first, last, schema, self, and canonical resources). string
offset Specify the starting index from where the results will be returned. number
orderBy Specify the field on which the results should be sorted.
Usage: orderBy=[fieldname]:[asc/des].
Note: For Lucene, sorting is possible only for fields that were indexed as "not tokenized".
string
q Specify a query string, the search engine-specific query that was specified during the configuration. (The default search engine is Lucene.) string
searchengine Specify what search engine to use to find the results. The default search engine is Lucene. string
totalResults Accepts a Boolean value. Setting it to true displays the total results field in the response. The default is false. boolean

The following tables summarize the server response.

Supported Media Types
  • application/json
  • application/xml

200 Response

List of all assets based on asset type

The following example shows how to get the first 3 AVIArticle names in ascending order of names in WebCenter Sites, by submitting a GET request on the REST resource using cURL. The REST URL also specifies to give only the next link.

Query param details:

  • "limit=3": Need only 3 results. Since 'offset' is not given, the default is 0.

  • "fields=name": Need only the name of an asset.

  • "orderBy=name:asc": In ascending order of name.

  • "links=next": Show only the next link.

curl -i -H "Accept: application/json" -X GET "http://<host>:<port>/<context>/REST/resources/v1/search/types/AVIArticle/assets?fields=name&orderBy=name:asc&limit=3&links=next"

Example of Response Header

The following example shows the response header.

Cache-Control: max-age=0 
ETag: "003bc74182f0edfa060603663a8839311cd8c2a4b8e57f1d7fd33d85c2fa0d1c" 
Content-Type: application/json;charset=utf-8

Example of Response Body

The following example shows the contents of the response body, in JSON format.

{
  "offset": 0,
  "limit": 100,
  "count": 3,
  "hasMore": true,
  "links": [
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/search/types/AVIArticle/assets?limit=3&orderBy=name:asc&links=next&fields=name&offset=3",
      "rel": "next",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    }
  ],
  "items": [
    {
      "name": "10 Important Baseball Rules for beginners",
      "link": {
        "href": "",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      },
      "id": "AVIArticle:1330881074927"
    },
    {
      "name": "100 Meter Sprint Versus A Marathon",
      "link": {
        "href": "",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      },
      "id": "AVIArticle:1363104065090"
    },
    {
      "name": "25 Nevada Resorts Serving Snow",
      "link": {
        "href": "",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      },
      "id": "AVIArticle:1328196047338"
    }
  ]
}