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"
}
}
}
}
}
}
Views
Replies
Total Likes
@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.
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.
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?
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"
}
}
}
}
}
Hey @Shashi_Mulugu the example JSON that you shared seems to be adding 1 page right? I wanted to know two things from you:
1. I need an example for multi element json
2. I need an example for content fragment rather than page.
what you can do is, create a folder testcontentfragments under /content/dam/ and create couple of CFs manually under the same path in your local AEM and use infinity.json or -1.json view to get the json of the parent folder like /content/dam/testcontentfragments.infinity.json and use similar json in the post request for new path.