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.
- Get the Morphous.Orchard fork of Orchard CMS and set up an Orchard site with database as normal.
- Get Morphous.Api and add it to your Orchard modules folder then include in the Visual Studio solution.
- Enable Morphous API in the modules section of your Orchard site's admin area.
Request a content item by its ID using the following URL scheme and headers. {address}/api/Contents/Item/{id}
Add ?displayType={value}
query string to the URL, possible values are Detail
or Summary
.
Add ?version={versionNumber}
query string to the URL to preview a draft content item.
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.
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>