Importing a JSON page in AEM using curl | Community
Skip to main content
Adobe Employee
June 27, 2025
Solved

Importing a JSON page in AEM using curl

  • June 27, 2025
  • 5 replies
  • 640 views

Hi all,

 

I have exported a page from AEM like this:

curl https://myhost/content/prodprj/us/mypg.-1.json | jq > content.json

 

This gives me the page as JSON. 

Now I have made a small change to this change (just changed some text) and I would like to push this change into AEM again.

 

I tried the following:

 

echo content.json | curl -v -F":operation=import" -F":contentType=json" -F":contentFile=@-" -F":nameHint=testing" https://myhost/content/prodprj/us/mypg

 

But that returns a 409 with the following message:

<td>Status</td>
<td><div id="Status">409</div></td>
</tr>
<tr>
<td>Message</td>
<td><div id="Message">repository state conflicting with request</div></td>
</tr>
<tr>
<td>Location</td>
<td><a href="/content/prodprj/us/mypg" id="Location">/content/prodprj/us/mypg</a></td>
</tr>
<tr>
<td>Parent Location</td>
<td><a href="/content/prodprj/us" id="ParentLocation">/content/prodprj/us</a></td>
</tr>
<tr>
<td>Path</td>
<td><div id="Path">/content/prodprj/us/mypg</div></td>
</tr>
<tr>
<td>Referer</td>
<td><div id="Referer"></div></td>
</tr>
<tr>
<td>ChangeLog</td>
<td><div id="ChangeLog">&lt;pre&gt;&lt;/pre&gt;</div></td>
</tr>
</tbody>
</table>
<p><a href="/content/prodprj/us/mypg">Modified Resource</a></p>
<p><a href="/content/prodprj/us">Parent of Modified Resource</a></p>

Does anyone know how to do this? Just export a page in JSON out of AEM, make a small change and then upload it again?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by sarav_prakash

The JSON Exporter is a delivery url to read AEM content. It doesn't allow write operation. In your case, its easier to open the page in edit mode and directly edit the page instead of XML ways. 

But still if you want an XML way of editing, use the content.xml. So you ll, package the page, download the package, unzip, edit the content.xml inside package, rezip, and ship the package back into AEM.

 

Refer here for curl commands. Steps ll be 

  1. Manually create package from package manager with path as 
    /content/prodprj/us/mypg
  2.  download the package curl -u admin:admin http://localhost:4502/etc/packages/my_packages/test.zip
  3. unzip 
  4. edit content.xml 
  5. rezip
  6. reinstall the package. 

5 replies

Adobe Employee
June 27, 2025

Or is it easier to do this with a content.xml file?

sarav_prakash
Community Advisor
sarav_prakashCommunity AdvisorAccepted solution
Community Advisor
June 29, 2025

The JSON Exporter is a delivery url to read AEM content. It doesn't allow write operation. In your case, its easier to open the page in edit mode and directly edit the page instead of XML ways. 

But still if you want an XML way of editing, use the content.xml. So you ll, package the page, download the package, unzip, edit the content.xml inside package, rezip, and ship the package back into AEM.

 

Refer here for curl commands. Steps ll be 

  1. Manually create package from package manager with path as 
    /content/prodprj/us/mypg
  2.  download the package curl -u admin:admin http://localhost:4502/etc/packages/my_packages/test.zip
  3. unzip 
  4. edit content.xml 
  5. rezip
  6. reinstall the package. 
narendragandhi
Community Advisor
Community Advisor
June 30, 2025

Hi @bosschaert 

 

You can use the Sling Post Servlet or the content importer service to get the updated json loaded in AEM. Please refer this article - https://blogs.perficient.com/2021/08/16/loading-json-content-into-aem/ for details.

 

Hope this helps!

 

Thanks

Narendra

arunpatidar
Community Advisor
Community Advisor
July 1, 2025

Hi @bosschaert 

You must be pushing the non-editable properties to AEM since those are imported as part of json. Can you try removing the other properties and just push the content property?

Arun Patidar
kautuk_sahni
Community Manager
Community Manager
July 9, 2025

@bosschaert Just checking in — were you able to resolve your issue?
We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!

Kautuk Sahni