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

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Assets API returning unsaved CFs

Avatar

Level 2

Hi All,

 

I am using the assets API to return a list of Content Fragments. If this is called while someone has started to create a CF but hasn't saved it, the API returns the partial CF (e.g. an empty shell).

 

There is no saved date on the CF on the API so does anyone have any suggestions on how to overcome this please?

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 5

No worries @AEM_PARTY , thanks for further explanation. I think I understand your use case now, but I also think we're not using the correct terminology ('saved') which is causing the confusion.

 

When a blank CF is created, it is in a 'saved' state.

Maybe what you're after are the CFs which are not empty? If thats the case then maybe you can look under the 'elements' property for a property (say, 'value' correpsonding to a CF field) if its empty or has a value.
Screen Shot 2022-08-25 at 10.05.58 am.png

 

Or maybe you are after the CFs that are not 'finalised' yet, meaning the author user is still working on it and hasn't finished writing it up. This would be tricky, as it more sounds like a business process rather than product. However I do see a property in CRX which seems to exists for a newly created CF only. But I don't see it in coming in assets API:
Screen Shot 2022-08-25 at 10.17.00 am.png

 

If you're lookiong for the CF that is published (which I suppose also indicates that the CF is 'finalised'), then you can look for the published property:
Screen Shot 2022-08-25 at 10.05.20 am.png

View solution in original post

2 Replies

Avatar

Level 5

I tried to reproduce the use case, but I'm able to get the create date of the content fragment. Below are my steps, let me know if any pf the steps are incorrect as per your use case:

 

1. Created a new blank content fragment called 'myCF1'.

Screen Shot 2022-08-23 at 3.43.43 pm.png

 

2. No content is yet saved in the content fragment, and is currently empty:

Screen Shot 2022-08-23 at 3.44.29 pm.png

 

3. Use asset API to get details of the content fragment:

http://localhost:4502/api/assets/myfolder/mycf1.json

Screen Shot 2022-08-23 at 3.48.44 pm.png

The 'created' property is in epoch time.

Avatar

Level 2

Thanks a lot for this.

 

Sorry, if I wasn't clear 🙂  The issue is I can't tell if the CF is saved or not. The created date doesn't confirm that the CF has been saved so there is no way to tell if this is a CF new and in the making or a saved one.

Avatar

Correct answer by
Level 5

No worries @AEM_PARTY , thanks for further explanation. I think I understand your use case now, but I also think we're not using the correct terminology ('saved') which is causing the confusion.

 

When a blank CF is created, it is in a 'saved' state.

Maybe what you're after are the CFs which are not empty? If thats the case then maybe you can look under the 'elements' property for a property (say, 'value' correpsonding to a CF field) if its empty or has a value.
Screen Shot 2022-08-25 at 10.05.58 am.png

 

Or maybe you are after the CFs that are not 'finalised' yet, meaning the author user is still working on it and hasn't finished writing it up. This would be tricky, as it more sounds like a business process rather than product. However I do see a property in CRX which seems to exists for a newly created CF only. But I don't see it in coming in assets API:
Screen Shot 2022-08-25 at 10.17.00 am.png

 

If you're lookiong for the CF that is published (which I suppose also indicates that the CF is 'finalised'), then you can look for the published property:
Screen Shot 2022-08-25 at 10.05.20 am.png