Hello,
I am using REST API to find all pages that are drafts.
Is there a way I can parse this information using a user macro? I understand that this can be parsed as JSON using JQuery, but I am not proficient in this language. All I simply want is the content in a string form.
Thanks for the he help.
Hi Bob!
I'm not sure how to do this with the Rest API, but I found a way to use methods from the PageManager interface to show the drafts, which may be more direct than using the API. PageManager has two methods that count drafts:
The user macro below shows both these methods to show the total number of drafts:
## Macro title: Show number of drafts
## Macro has a body: N
## Body processing: No macro body
## @noparams
#set ($pageManager=$action.getPageManager())
#set ($totalDrafts=$pageManager.countDraftPages() + $pageManager.countPagesWithUnpublishedChanges())
<strong>New page drafts:</strong> $pageManager.countDraftPages()<br>
<strong>Unpublished changes:</strong> $pageManager.countPagesWithUnpublishedChanges()<br>
<strong>Total drafts:</strong> $totalDrafts
(For more information on these methods, see the PageManager Interface docs)
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.