How to retrieve recent updates/contributions via API?

Using the “recently updated” macro, I am able to create a page in confluence that shows all recent activity from all the users within the space. It shows recent updates, edits, attachments, deletions etc.

Is there any way to access this data via API? I can get all of these contributions as email notifications, but is there any way for me to get this data directly?

The main reason why I want this is because I want to be able to see how much my users are each contributing to our confluence space. If I can retrieve this data, store it, I can then run my own analytics to see which user is doing the most in a given time frame.

I’ve gone through a number of API queries but can’t seem to find the one that gives me this information. As a workaround, I tried to use

{{host}}/wiki/rest/api/content/{{page_id}}?expand=body.storage

but it didn’t return the content that was supplied by the macro.

Is there anyway I can get all the recent updates/contributions?

Thank you!

Welcome to the Atlassian Developer Community, @roovy !

Have you tried the Search content by cql API? Something like /wiki/rest/api/content/search?cql=type%20in%20(page,blogpost)%20order%20by%20lastmodified%20desc&limit=25 should return pages and blogposts with the most recently updated content at the top.

Cheers,
Ian

1 Like

Thank you for this response Ian!
It works pretty well to return the most recently updated pages.


The only two issues I seem to find is that it doesn’t show the username or user ID of who actually made the contribution which defeats the purpose.
Secondly, and albeit slightly less important, it only seems to find pages that were updated. However, in the “recently updated” section, it shows things like attaching a photo as a separate line item contribution.
However, if there’s a way to get the user ID of who made this update, then I think it would be a workable solution.
Do you know if there’s a way to do that? Or am I just missing something?
Thank you!

Hi @roovy ,

You can use the expand query parameters. For your use case you might want to expand history.lastUpdated but feel free to check out all the other possible values in the docs to get the information you need.

Here, you just need to update the CQL and add attachment - something like type IN (page,blogpost,attachment). If you’re also interested with comments then add comment too.

Cheers,
Ian

Marked your response as the solution; It was exactly what I needed.
Thank you Ian!

1 Like