Content API - Documentation topics on: api,content api,rest,.

Content API

Retrieves a list or a piece of content in JSON or XML format.

Base url: /api/content/

RESTful Content

The easiest way to see how to use the restful content API is to click on the Content tab and search for the content you want to display. Click on Search –> Show Query, the URL is shown as: Rest API Call URLEncoded (Use this URL for external aplications or javascript on your page). You can either click on this URL or copy/paste to use on your Widget Code.

View Query Button

Authentication

This API supports the same REST auth infrastructure as other rest apis in dotcms. Please see the page on REST authentication for more information.

Parameters:

query

(Mandatory unless you are using the 'id' param) Lucene query to search for content.

Usage: /api/content/query/<your-query>

Example: /api/content/query/+contentType:TestFilesAndImages +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST) +languageId:1 +deleted:false +working:true

id

(Mandatory unless you are using the 'query' param) identifier of the contentlet to search for

Usage: /api/content/id/<an-identifier>

Example: /api/content/id/17723c01-d9ae-4ca9-b11f-6125961509c1

inode

(Mandatory unless you are using the 'query' param) inode of the contentlet to search for

Usage: /api/content/inode/<an-inode>

Example: /api/content/inode/17723c01-d9ae-4ca9-b11f-6125961509c1

type

(Optional) Specifies if the resultant content must be returned in JSON, XML or JSONP (available for 2.6 and above) format. Defaults to 'json'.

Usage: /api/content/<json|xml|jsonp>

Example: /content/type/json

render

(Optional) Determines if the retrieved content must be parsed or not (only in case the content is a widget).

Usage: /api/content/render/<true|false>

Example: /api/content/render/true

orderby

(Optional) Specifies an order criteria for the results. Defaults to moddate desc

Usage: /api/content/orderby/

Example: /api/content/query/+live:true/orderby/moddate asc/

offset

(Optional) Specifies an offset for the resulting list, so if given, the resulting list will startfrom this position.

Usage: /api/content/offset/<integer-offset>

Example: /api/content/query/+live:true/orderby/moddate asc/offset/10

limit

(Optional) Specifies a limit number for the resulting list.

Usage: /api/content/limit/<integer-limit>

Example: /api/content/query/+live:true/orderby/moddate asc/offset/10/limit/30

user/password

(Optional) Specifies a username or email and a password to use when searching the content.

Usage: /api/content/user/<username-or-email>/password/<password>

Example: /api/content/query/+live:true/user/admin@dotcms.com/password/123