Expand my Community achievements bar.

SOLVED

Update content with JSON

Avatar

Level 2

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

Thanks,

Aditya Chabuku

View solution in original post

7 Replies

Avatar

Community Advisor

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

Avatar

Level 2

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!

Avatar

Level 2

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? 

Avatar

Correct answer by
Community Advisor

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

Thanks,

Aditya Chabuku

Avatar

Community Advisor

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

 

Avatar

Community Advisor

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

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

- It should allow you to update multiple metadata via excel

 


Aanchal Sikka