Vous consultez actuellement l'aide de la version:

Remarque :

Adobe recommends using the SPA Editor for projects that require single page application framework-based client-side rendering (e.g. React). Learn more.

AEM content can easily be rendered via Sling Default Servlets to render JSON and other formats.

Those out-of-the-box renders typically walk the repository and return content as is.

AEM, via Sling, also supports developing and deploying custom sling renderers to take full control of the rendered schema and content.

Content Services Default Renderers fill the gap between out-of-the-box Sling Defaults and Custom Development allowing customization and control of many aspects of the rendered content without development.

The following diagram shows the rendering of content services.

chlimage_1

Requesting JSON

Use <RESOURCE>.caas[.<EXPORT-CONFIG][.<DEPTH-INT>].json to request JSON.

RESOURCE an entity resource under /content/entities
or 
a content resource under /content
EXPORT-CONFIG

OPTIONAL

an export configuration found under /apps/mobileapps/caas/exportConfigs/EXPORT-CONFIG

If omitted the default export configuration will be applied 

DEPTH-INT OPTIONAL

depth recursion for rendering of children as used in Sling rendering

Creating Export Configs

Export configs can be created to customize JSON rendering. 

You can create a configuration node under /apps/mobileapps/caas/exportConfigs.

Node Name Name of the configuration (for rendering selector)
jcr:primaryType nt:unstructured

The following table shows the properties of Export Configs:

Name Type Default (if, not set) Value Description
includeComponents String[] include everything sling:resourceType exclude details for nodes with specified sling:resourceType from JSON export
excludeComponents String[] exclude nothing sling:resourceType include details only for nodes with specified sling:resourceType from JSON export
excludePropertyPrefixes String[] exclude nothing Property prefixes exclude properties that start with specified prefixes from JSON export
excludeProperties String[] exclude nothing Property names exclude specified properties from JSON export
includeProperties String[] include everything Property names

if excludePropertyPrefixes set
this includes specified properties despite matching the prefix being excluded,

else (exclude properties ignored) only include these properties

includeChildren String[] include everything child names exclude specified children from JSON export
excludeChildren String[]

exclude nothing child names include only specified children from JSON export, exclude other
renameProperties String[]

rename nothing <actual_property_name>,<replacement_property_name> rename properties using replacements

Resource type export overrides

Create a configuration node under /apps/mobileapps/caas/exportConfigs.

name resourceTypeOverrides
jcr:primaryType nt:unstructured

The following table show the properties:

Name Type Default (if, not set) Value Description
<SELECTOR_TO_INC> String[]  - sling:resourceType For the following sling resource types, don't return the deafult CaaS json export.
Return a customer json export by rendering the resource as;
<RESOURCE>.<SELECTOR_TO_INC>.json 

Existing Content Services Export Configs

Content Services include two export configurations:

  • default (no config specified) 
  • page (to render site pages)

Default Export Configuration

Content Services default export configuration will be applied if a config is specified in the requested URI. 

<RESOURCE>.caas[.<DEPTH-INT>].json

Name Value
excludeProperties  
excludePropertyPrefixes jcr:,sling:,cq:,oak:,pge-
includeProperties jcr:text,text
jcr:title,title
jcr:description,description
jcr:lastModified,lastModified
cq:tags,tags
cq:lastModified,lastModified
includeComponents  
excludeComponents  
includeChildren  
excludeChildren  
Sling JSON Overrides foundation/components/image
wcm/foundation/components/image
mobileapps/caas/components/data/contentReference
mobileapps/caas/components/data/assetlist

Page Export Configuration

This configuration extend the default to include grouping children under a child node.

<SITE_PAGE>.caas.page[.<DEPTH-INT>].json

Additional Resources

See the resources below to learn about additional topics in Content Services:

Ce produit est distribué sous licence Creative Commons Attribution - Pas d’utilisation commerciale - Partage à l’identique 3.0 non transposé  Les publications Twitter™ et Facebook ne sont pas couvertes par les dispositions Creative Commons.

Mentions légales   |   Politique de confidentialité en ligne