Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Get file name from file url

Avatar

Level 4

Hello,

I have a field on Content fragment to add files. What returns to me is the file path. But, I should display the file name. Should I create an API for this, or there is already an API, where I can send the path so I can get the file and its name? Thanks!

0 Replies

Avatar

Community Advisor

May i know how you are using the content fragment ? Referring it in page using Content Fragment component ?

 

or exposing it as an API via graphql/HTTP assets api

Avatar

Community Advisor

Hi @AD-Engineer - You can follow the same approach as in https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-page-description-from-...

 

The response of .json call with contain the page name in the field jcr:title, pageTitle based on context of usage.

 

Thanks,

Fani

Avatar

Community Advisor

Hi,

I am not sure of this is feasible because the reference generally used to read/fetch further content, so having path there make sense. Probably from front end/consumer API side you can trim the path and just use it file name as needed.

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now