Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[API question] Confluence pages which are created in certain period.

조성진_상연_
Contributor
April 15, 2021

Hi, 

I want to know to find which confluence pages created in some period.

For example,

I create many pages this month (2021-04) and

I want to know which Pages I created this week. (2021-04-12 ~ 2021-04-16).

 

Is there any API to filter create date(or modified date) for all pages in a specific space?

1 answer

1 accepted

1 vote
Answer accepted
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 20, 2021

Hello @조성진_상연_! We sure have a way to filter your content via API.

You can use REST API to filter this content in Confluence. The search would look like this:

https://your-domain.atlassian.net/wiki/rest/api/content/search?cql=type=page+and+created>="2021/04/12"+and+created<="2021/04/16"+and+space="spacename"

 

You can check more details about REST API and how to perform advanced searches with it here:

 

I hope this helps!

조성진_상연_
Contributor
April 20, 2021

Hi, @Diego  Thank you for your answer,

I tried your suggestion, but it seems not working

I'm sure I have created many pages, but the result is empty.

I get my space name from this api

  •  /wiki/rest/api/space?limit=100

(space name is Korean word)

 

I've searched many hours for this api, and really delighted to see your answer.

Could you give me more ideas to solve this problem?

res.png

Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 23, 2021

Yes sure!

I, incorrectly, used "spacename" value in the space field. The call would look like this:

https://yoursite.atlassian.net/wiki/rest/api/content/search?cql=type=page+and+created>="2021/04/12"+and+created<="2021/04/16"+and+space=spacekey

 

So, if your space's space key is SPC, the value for space would look like this:

space=SPC

Let me hear from you!

조성진_상연_
Contributor
April 25, 2021

@Diego My team have serveral spaces 

and results is below

 

1. when spacekey is just consist of alphabets : works

2. when spacekey is ~number format : not work

 

most of spaces are seconde type (ex. spacekey :"~12345678"

(below screenshot, I delete partially id, name, key )

 qu1.png

 

 

Do you know how to use ~{number} style in spacekey query? 

Best regards

Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2021

Interesting. It looks like that you are trying to query a Personal Space for the pages.

In that case, the Space Key value must be escaped with "", like this:

space="~12345678" 

The query would look like this:

https://yoursite.atlassian.net/wiki/rest/api/content/search?cql=type=page+and+created>="2021/04/12"+and+created<="2021/04/16"+and+space="~12345678"

I tested this on my own personal space and the expected results are present.

I hope this helps!

조성진_상연_
Contributor
April 28, 2021

@Diego oh, You are really awesome!!

tons of thanks for your effort, Finally I got what I want from this API.

Again Thanks!

Like Diego likes this
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2021

Glad to help!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events