Skip to content

Latest commit

 

History

History
59 lines (34 loc) · 2.17 KB

README.md

File metadata and controls

59 lines (34 loc) · 2.17 KB

Morphous.Api

Morphous.Api is an Orchard module containing an ApiController that returns Orchard content items as JSON. To use this module you must be using Morphous.Orchard, our modified fork of Orchard CMS.

For more information and examples, see this blog post.

Installation (Visual Studio)

  1. Get the Morphous.Orchard fork of Orchard CMS and set up an Orchard site with database as normal.
  2. Get Morphous.Api and add it to your Orchard modules folder then include in the Visual Studio solution.

Add module

  1. Enable Morphous API in the modules section of your Orchard site's admin area.

Enable module

Usage

Request a content item by its ID using the following URL scheme and headers. {address}/api/Contents/Item/{id}

 

Request content item

Options

DisplayType

Add ?displayType={value} query string to the URL, possible values are Detail or Summary.

Preview

Add ?version={versionNumber} query string to the URL to preview a draft content item.

Alternates

Morphous supports alternates which can be specified in the Accept-Alternates header. The options built into Morphous.Api are:

  • If you don't specify this header then the default format is fairly flat but with some detail about content parts and fields.
  • flat - returns content items in a flattened, typical DTO type format.

Placement

Use the BindingType attribute in the <Match> element to target either JSON or HTML output separately. "Translate" targets the JSON output. "Display" targets the normal HTML output.

<Match BindingType="Translate">
    <Place Parts_Common_Body="-"/>
</Match>
<Match BindingType="Display">
    <Place Parts_Title="-"/>
</Match>