How to get nodes as JSON

Avatar

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
doeringa
Level 2

15-10-2015

Hi, 

I have a component on a page. Once this component is authored, I need to pick up it's node properties as Json from another Java App via an URL. 

What's the best way to achieve this? I read about very different approaches (json query servlet, write my own servlet etc.) to this and am unsure which way to go.

Any help is very appreciated. 

Thanks, 

Alex

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile
kalyanar
Employee

15-10-2015

Suppose you have a node /apps/brand. Then  you can get the node properties by http://localhost:4502/apps/brand.json

Answers (5)

Answers (5)

Avatar

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
doeringa
Level 2

15-10-2015

Oh man. I was just being stupid 🙂

Got it now. Thanks!!

Avatar

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile
kalyanar
Employee

15-10-2015

IIUC, is your qn "the component would have no nodes created under the page.how to display this via json call?"

Avatar

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
doeringa
Level 2

15-10-2015

OK. But the resource from which I want to pick up the node properties is a cq:include on a page. How can I access that? 

e.g: the page /apps/brand has a text image component on it and I want only those properties. I know that I could get all nodes on the /apps/brand page via "http://localhost:4502/apps/brand.json" but I only want the nodes from that one component on it. Is there a way to do that?

Thanks for your help!

Avatar

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
doeringa
Level 2

Likes

3 likes

Total Posts

54 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
doeringa
Level 2

15-10-2015

Hi Kalyanar, 

thanks for your reply. 

Can you provide some more details please on how to do that.

Thanks, 

Alex

Avatar

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile

Avatar
Boost 5
Employee
kalyanar
Employee

Likes

5 likes

Total Posts

182 posts

Correct reply

78 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 50
Affirm 5
View profile
kalyanar
Employee

15-10-2015

If you just want the json as is from the node, then you can use the oob json servlet.