Expand my Community achievements bar.

SOLVED

how to update a json file in JCR repository by using sling servlet ?

Avatar

Level 4

I have a requirement like to update json file by using sling servlet waking up with ajax call .

 

like:

Path: apps/myproject/jsonfile/xyz.json

 

keshava219_0-1657262899176.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@keshava219  you may just need to call the servlet via form-submit/ajax,

call the 3rd party API from the servlet ,

get the resonpse ,

manupulate the data as required and use JCR APIs to manupulate JCR nodes etc.

and send it back via response object.

 

you can also ref these links.: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-where-to-store-json...

https://aemsimplifiedbynikhil.wordpress.com/2019/10/04/read-write-data-in-json-file-of-dam-in-aem-ma...

 

 

View solution in original post

3 Replies

Avatar

Level 4

Hi @Manu_Mathew_ ,

 

                 i want to update  json values which coming from thirdparty api to store in jcr repository that will render in dialog dropdown .

 

to get this requirement i need to use ajax call to send some params  and then servlet will update json file 

 

 

Avatar

Correct answer by
Community Advisor

@keshava219  you may just need to call the servlet via form-submit/ajax,

call the 3rd party API from the servlet ,

get the resonpse ,

manupulate the data as required and use JCR APIs to manupulate JCR nodes etc.

and send it back via response object.

 

you can also ref these links.: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-where-to-store-json...

https://aemsimplifiedbynikhil.wordpress.com/2019/10/04/read-write-data-in-json-file-of-dam-in-aem-ma...