Update content with JSON | Community
Skip to main content
Level 2
October 12, 2023
Solved

Update content with JSON

  • October 12, 2023
  • 3 replies
  • 2358 views

Hello there,

 

I extracted a page content configuration by adding the suffix "infinity.json", then I did a curl to that page to extract this JSON to a file.

 

Can I somehow edit this JSON and upload it again in order to update the content with a curl or a fetch?

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 Aditya_Chabuku

Not sure if I could use that. The points is to have a "Content as Code" and whenever I want to change something I just had to upload the json. Is that somehow feasible? 


Hi @caradeotario ,

 

That's  not recommended 

as@sudheer_sundalam  suggested, have a process for content updating with proper user permissions and you can export data as JSON.

 

Thanks,
Aditya Chabuku

CA_Signature2.png

3 replies

SantoshSai
Community Advisor
Community Advisor
October 12, 2023

Hi @caradeotario ,

You could achieve this by updating JCR Node property. 

eg. 

 

curl -v -u admin:admin -X POST http://localhost:4502/content/mysite/jcr:content --data-urlencode 'isCurlWorking=true'

 

Hope that helps!

Regards,

Santosh

Santosh Sai
Level 2
October 12, 2023

Hi @santoshsai ,

What If i need to update multiple properties?
Is there a way to use the json file that I edited with all the properties?

 

Thanks for your answer!

SantoshSai
Community Advisor
Community Advisor
October 12, 2023

@caradeotario - In that case (making multiple edits), I would prefer Bulk Editor: 

The Bulk Editor allows for efficient editing when the visual page context is not needed. Kindly refer below articles for more details: 

[0]: https://experienceleague.adobe.com/docs/experience-manager-65/administering/operations/bulk-editor.html?lang=en

[1]: https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/dev-bulk-editor.html?lang=en

[2]: https://www.dlighthouse.co/2018/11/using-aem-bulk-editor.html 

Santosh Sai
Sudheer_Sundalam
Community Advisor
Community Advisor
October 12, 2023

@caradeotario ,

 

I wonder what could be the use case where you want to update the page content using the curl command when the same page can be authored via page editor. With or without curl, you would need same level of user permission to update the content nodes.

 

If the content nodes of a page needs to be updated based on an event/schedule, I would read the nodes in an OSGI service and update them accordingly using a system_user where I will more control over the nodes and permissions. 

Just a thought!

 

aanchal-sikka
Community Advisor
Community Advisor
October 13, 2023

Hello @caradeotario 

 

The curl and Bulk Editor options have already been suggested by @santoshsai and @aditya_chabuku .

 

Requesting you please check the "Data Importer" on https://adobe-consulting-services.github.io/acs-aem-commons/features/mcp-tools/data-importer/index.html

This utility allows you to import data from a spreadsheet into AEM. 

- It should allow you to update multiple metadata via excel

 

Aanchal Sikka