Skip to main content
Level 4
Oct 10, 2022 8:58 AM UTC
Question

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

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.

5 replies

Shashi_Mulugu
New Participant
Oct 10, 2022 10:26 AM UTC

@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.

Translate
Level 4
Oct 10, 2022 10:41 AM UTC

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?

Translate
Shashi_Mulugu
New Participant
Oct 10, 2022 12:30 PM UTC

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"
}
}
}
}
}

Translate