Aem Assets HTTP API

Aem Assets HTTP API

Till AEM 6.5 content + code + assets are part of AEM, but from AEM as could services DAM is separated. Below is the architecture of DAM.

1. Clients, such as web browsers, send an upload request to Experience Manager and begin uploading the binary directly to the binary cloud storage.

2. Upon completing the direct binary upload, the client notifies Experience Manager.

3. Experience Manager then sends a processing request to asset microservices. The request's contents are determined by the processing profiles configuration in Experience Manager, which specifies the renditions to generate.

4. The back end of Asset microservices accepts the processing request and dispatches it to one or more microservices based on the request. Each microservice directly retrieves the original binary from the binary cloud storage.

5. The processing results, such as renditions, are stored in the binary cloud storage.

6. A process completion notification is sent to Experience Manager along with direct pointers to the generated binaries (renditions). The generated renditions for the uploaded asset are then available in Experience Manager.

The Adobe Experience Manager (AEM) Assets HTTP API is a RESTful web service interface that allows developers to programmatically interact with the AEM Digital Asset Management (DAM) system. This API provides endpoints for various operations on digital assets, including uploading, downloading, searching, and managing metadata.

Key Capabilities of the AEM Assets HTTP API

  • Retrieving Assets
  • Updating Asset Metadata
  • Searching for Assets
  • Deleting Assets
  • Managing Renditions
  • Creating folder
  • Add a comment on asset
  • Copy a folder/ asset
  • Move a folder/ asset
  • Handling Content fragment.


  1. Retrieving folder listings.

https://localhost:4502/api/assets/wknd.json


The returned entity can be either an asset or a folder. The properties of the entities it contains are only a subset of their full properties. To get the complete details of an entity, clients should follow the URL indicated by the link with a rel attribute of "self".


2. Creating a folder?

  • To create folder we have to use the post method and the url will be?
  • https://localhost:4502/api/assets/wknd/en/site/*
  • we have to pass the parameters name and title where name is mandatory.
  • we have to provide content type as application/json.

Request

  • POST /api/assets/myFolder -H"Content-Type: application/json" -d '{"class":"assetFolder","properties":{"title":"My Folder"}}'
  • POST /api/assets/* -F"name=myfolder" -F"title=My Folder"

Folder created under Wknd assets


3. Update metadata of an asset.

Any metadata fields that need to be updated, such as title, description, etc.

https://localhost:4502/api/assets/wknd/en/site/wkndassets/Css.png

{

? ? "class": "asset",

? ? "properties": {

? ? ? ? "dc:title": "csstitle"

? ? }

}


Updated image title

Updates the Asset metadata properties. If you update any property in the?dc:?namespace, the API updates the same property in the?jcr?namespace. The API does not sync the properties under the two namespaces.


4. Create an asset rendition

Create a rendition for an asset. If request parameter name is not provided, the file name is used as rendition name.

  • POST /api/assets/myfolder/myasset.png/renditions/web-rendition -H"Content-Type: image/png" --data-binary "@myRendition.png"
  • POST /api/assets/myfolder/myasset.png/renditions/* -F"name=web-rendition" -F"[email protected]"

https://localhost:4502/api/assets/wknd/en/site/wkndassets/Css.png/renditions/Html.jpg

New rendition adder for the image with new image


  • We can create/update renditions but we cannot create new assets with asset http api


5. Add comments on assets


The parameters are?message?for the message body of the comment and?annotationData?for the Annotation data in JSON format.

https://localhost:4502/api/assets/wknd/en/site/wkndassets/Css.png/comments/Html.jpg

Comments added for the image


6. Delete a folder or an asset

Deletes a resource (-tree) at the provided path.

Request

  • DELETE /api/assets/myFolder
  • DELETE /api/assets/myFolder/myAsset.png
  • DELETE /api/assets/myFolder/myAsset.png/renditions/original


7. Move a folder or an asset

Moves a folder or asset at the given path to a new destination.

Request Headers: The parameters are:

  • X-Destination?- a new destination URI within the API solution scope to copy the resource to.
  • X-Depth?- either?infinity?or?0. Using?0?only copies the resource and its properties and not its children.
  • X-Overwrite?- Use either?T?to forcibly delete an existing resources or?F?to prevent overwriting an existing resource.
  • Request:?MOVE /api/assets/myFolder -H"X-Destination: /api/assets/myFolder-moved"


8. Copy a folder or an asset

Copies a folder or asset available at the provided path to a new destination.

Request Headers: The parameters are:

  • X-Destination?- a new destination URI within the API solution scope to copy the resource to.
  • X-Depth?- either?infinity?or?0. Using?0?only copies the resource and its properties and not its children.
  • X-Overwrite?- Use?F?to prevent overwriting an asset at the existing destination.

Request:?COPY /api/assets/myFolder -H"X-Destination: /api/assets/myFolder-copy"

Conclusion:

By providing a comprehensive set of endpoints for managing assets, it enables developers to automate workflows, integrate with other systems, and improve overall efficiency in handling digital content. Whether you are looking to streamline asset uploads, update metadata, or search for assets, the AEM Assets HTTP API offers the functionality needed to achieve these tasks effectively.

Srikanth Pothuraju

Adobe Certified Expert Sites Developer | AEM Developer

8 个月

??

回复

要查看或添加评论,请登录

Shashank Karnati的更多文章

社区洞察

其他会员也浏览了