Reputation: 3
My goal is to retrieve the number of the new pages created each month in Confluence. I want to use Confluence API, but Get Content doesn't seem like it provides the type of customization that would allow for returning a list of new pages or the number of new pages "by creation date." Can anyone point me in the right direction?
Upvotes: 0
Views: 555
Reputation: 3719
Have a look at Advanced Searching using CQL, they even described your usecase :)
The keyword you need is the created parameter. So if you want to search for all content created within the last 4 weeks (created > now("-4w")), you can try the following query:
/rest/api/content/search?cql=created%20>%20now("-4w")
This should return something like this, where size is the value you've been looking for
{
"results": [{
...
}],
"start": 0,
"limit": 1000,
"size": 1,
"_links": {
...
}
}
You can check the accuracy by adding the &expand=history parameter and see the createdDate for each page.
Be careful with the limit of results (by default 25). You can prevent this by setting a limit yourself &limit=1000. If you use an expand parameter, there is a max limit for searching - kinda confusing...
This should be the query for your search to find max 1000 new pages created in the last 4 weeks:
/rest/api/content/search?cql=created%20>%20now("-4w")&limit=1000
Upvotes: 0