내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Create node By Json Data

Avatar

Level 5

Hi,

I need to write a servlet to hit the third party URL(its a open source url) and this URL returning data in json format.I need to store these data in node.Please suggest

 

 

Regards,

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 3
Inside servlet  use HTTPClient (from apache commons) api to hit 3rd party url and get the data. If you response is in JSON format use JSONObject or JSONArray objects (from sling commons) and inject the response to the constructors of those objects. From those json objects you get the values by passing keys. Now to create new nodes use Node api (from javax.jcr) and set appropriate properties to the node and save the session by using session.save() method. PS: Your nodes will be created only after execution of session.save() method

원본 게시물의 솔루션 보기

2 답변 개

Avatar

정확한 답변 작성자:
Level 3
Inside servlet  use HTTPClient (from apache commons) api to hit 3rd party url and get the data. If you response is in JSON format use JSONObject or JSONArray objects (from sling commons) and inject the response to the constructors of those objects. From those json objects you get the values by passing keys. Now to create new nodes use Node api (from javax.jcr) and set appropriate properties to the node and save the session by using session.save() method. PS: Your nodes will be created only after execution of session.save() method

Avatar

Level 10

See this AEM article that shows you how to use the JCR API to save data in the JCR -- 

http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html

In your servlet - after you get back the JSON data, create app logic to store the data in the JCR.