AEM Assets API : Is it possible to migrate in bulk instead of single elements? | Community
Skip to main content
Level 4
October 10, 2022
Question

AEM Assets API : Is it possible to migrate in bulk instead of single elements?

  • October 10, 2022
  • 1 reply
  • 1137 views

I would like to make a POST request to migrate elements in bulk. Can I do it in one API call instead of making multiple post request? Here's how my body looks like:

{ "properties": { "description": "This is a Category Example", "title": "Category Example", "cq:model": "/conf/models/category", "elements": { "title": { "value": "Category-master", "variations": { "en": { "value": "Category English" }, "es": { "value": "Category Spanish" } } }, "uri": { "value": "Category-Uri-master", "variations": { "en": { "value": "Category uri English" }, "es": { "value": "Category uri Spanish" } } }, "id": { "value": "Category-id-master", "variations": { "en": { "value": "Category-id-master" }, "es": { "value": "Category-id-master" } } } } } }
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Shashi_Mulugu
Community Advisor
Community Advisor
October 10, 2022

@spidey1405 Yes ofcourse leveraging the power of Apache Sling, an open-source RESTful web framework that is part of Adobe Experience Manager's underlying technology stack.

 

https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html

 

you can form the post servlet url till the root path of where you would like to create the resources and post to AEM instance with basic authorizarion header of the user who has write access under the specific heirarchy.

Level 4
October 10, 2022

The document that you shared looks a bit overwhelming to me. Can you share the example of request structure and the endpoint so that I could take that up and then make a requests?

Shashi_Mulugu
Community Advisor
Community Advisor
October 10, 2022

POST URL:- https://AEMhost/content/poc -> root hierarchy under AEM Site Structure where page will be created.
POST Form Data:-
“:operation” : “import”
“:contentType” : “json”
“:name” -> String value, it is the name of the page in AEM and should be unique under a hierarchy.
“:content” :"REFER to below JSON"

 

SAMPLE JSON to which will create Page

{
"jcr:primaryType": "cq:Page",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:title": "SAMPLE-AEM-Page-NAME",
"cq:template": "/conf/myproject/settings/wcm/templates/article-page",
"cq:contextHubSegmentsPath": "/etc/segmentation/contexthub",
"cq:conf": "/conf/myproject",
"sling:resourceType": "myproject/components/page",
"cq:contextHubPath": "/etc/cloudsettings/default/contexthub",
"root": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "myproject/components/container",
"container": {
"jcr:primaryType": "nt:unstructured",
"layout": "responsiveGrid",
"sling:resourceType": "myproject/components/container",
"article": {
"jcr:primaryType": "nt:unstructured",
"teaser": "SAMPLE-TEASER-TEXT",
"desc": "SAMPLE-DESCRIPTION-TEXT",
"title": "SAMPLE-TITLE-TEXT",
"sling:resourceType": "myproject/components/article"
}
}
}
}
}