Assets HTTP API

The Assets HTTP API encompasses the:

  • Assets REST API
  • including support for Content Fragments

The current implementation of the Assets HTTP API is based on the REST architectural style and enables you to access content (stored in AEM) via CRUD operations (Create, Read, Update, Delete).

With these operation the API lets you operate Adobe Experience Manager as a headless CMS (Content Management System) by providing Content Services to a JavaScript front end application. Or any other application that can execute HTTP requests and handle JSON responses. For example, Single Page Applications (SPA), framework-based or custom, require content provided over an API, often in JSON format.

Assets HTTP API and Content Fragments

Content Fragments are used for headless delivery, and a Content Fragment is a special type of asset. They are used to access structured data, such as texts, numbers, dates, among others.

Using the Assets REST API

Access

The Assets REST API uses the /api/assets endpoint and requires the path of the asset to access it (without the leading /content/dam).

  • This means that to access the asset at:
    • /content/dam/path/to/asset
  • You need to request:
    • /api/assets/path/to/asset

For example, to access /content/dam/wknd/en/adventures/cycling-tuscany, request /api/assets/wknd/en/adventures/cycling-tuscany.json

NOTE
Access over:
  • /api/assets does not need the use of the .model selector.
  • /content/path/to/page does require the use of the .model selector.

Operation

The HTTP method determines the operation to be executed:

  • GET - to retrieve a JSON representation of an asset or a folder
  • POST - to create new assets or folders
  • PUT - to update the properties of an asset or folder
  • DELETE - to delete an asset or folder
NOTE
The request body and/or URL parameters can be used to configure some of these operations; for example, define that a folder or an asset should be created by a POST request.

The exact format of supported requests is defined in the API Reference documentation.

Usage can differ depending on whether you are using an AEM author or publish environment, together with your specific use case.

  • It is strongly recommended that creation is bound to an author instance (and currently there is no means to replicate a fragment to publish using this API).

  • Delivery is possible from both, as AEM serves requested content in JSON format only.

    • Storage and delivery from an AEM author instance should suffice for behind-the-firewall, media library applications.

    • For live web delivery, an AEM publish instance is recommended.

CAUTION
The dispatcher configuration on AEM instances might block access to /api.
NOTE
For further details, see the API Reference. In particular, Adobe Experience Manager Assets API - Content Fragments.

Read/Delivery

Usage is via:

GET /{cfParentPath}/{cfName}.json

For example:

http://<host>/api/assets/wknd/en/adventures/cycling-tuscany.json

The response is serialized JSON with the content structured as in the content fragment. References are delivered as reference URLs.

Two types of read operations are possible:

  • Reading a specific content fragment by path, this returns the JSON representation of the content fragment.
  • Reading a folder of content fragments by path: this returns the JSON representations of all content fragments within the folder.

Create

Usage is via:

POST /{cfParentPath}/{cfName}

The body has to contain a JSON representation of the content fragment to be created, including any initial content that should be set on the content fragment elements. It is mandatory to set the cq:model property and it must point to a valid content fragment model. Failing to do so will result in an error. It is also necessary to add a header Content-Type which is set to application/json.

Update

Usage is via

PUT /{cfParentPath}/{cfName}

The body has to contain a JSON representation of what is to be updated for the given content fragment.

This can simply be the title or description of a content fragment, or a single element, or all element values and/or metadata.

Delete

Usage is via:

DELETE /{cfParentPath}/{cfName}

For further details of using the AEM Assets REST API, you can reference:

  • Adobe Experience Manager Assets HTTP API (Additional Resources)
  • Content Fragments Support in AEM Assets HTTP API (Additional Resources)

What’s Next

Now that you have completed this part of the AEM Headless Developer Journey, you should:

  • Understand the basics of the AEM Assets HTTP API.
  • Understand how Content Fragments are supported in this API.

You should continue your AEM headless journey by next reviewing the document How to Go Live with Your Headless Application where you actually take your AEM Headless project live!

Additional Resources

Experience Manager


Rapid Feature Releases with AEM Cloud: Telegraph Media Group’s RDE Strategy

Online | Session | Intermediate

Hear how Telegraph Media Group, the award-winning publisher of The Daily Telegraph, The Sunday Telegraph, The Telegraph Magazine,...

Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)

Register

Driving Marketing Agility and Scale: Transforming your Content Supply Chain with AI

Online | Strategy Keynote | General Audience

Marketers everywhere are feeling the pressure to deliver impactful campaigns faster and at greater scale. This Strategy Keynote explores...

Tue, Mar 18, 2:30 PM PDT (9:30 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more