Expand my Community achievements bar.

SOLVED

Get page description from page url

Avatar

Level 4

Hello,

I have a list of page url-s. For each of them I have to get the page description. Is there any ready API to send the page url from JS in order to get the page description? Or should I create an API? Thanks! 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @AD-Engineer -

 

I assume, you are referring to the description stored on the page in jcr:content node.

If yes, you can retrieve it in javascript by accessing the path over HTTP or Ajax call in the format %page_path%/jcr:content.json.

Ex: /content/we-retail/language-masters/en/men/jcr:content.json for the page content/we-retail/language-masters/en/men.html

 

This gives the completed information present on the node along with description in json format.

 

Thanks,

Fani

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @AD-Engineer -

 

I assume, you are referring to the description stored on the page in jcr:content node.

If yes, you can retrieve it in javascript by accessing the path over HTTP or Ajax call in the format %page_path%/jcr:content.json.

Ex: /content/we-retail/language-masters/en/men/jcr:content.json for the page content/we-retail/language-masters/en/men.html

 

This gives the completed information present on the node along with description in json format.

 

Thanks,

Fani

Avatar

Community Advisor

I think you should reconsider the implementation, instead of return just path from list, return the title, description etc as an object and reuse it.

If it is not possible then you should consider creating a dedicated api. You should not be using OOTB json, which leads into security vulnerability if .json is not unblocked for all the request.



Arun Patidar