[API question] Confluence pages which are created in certain period.
Asked by ???_??_:

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?


Answers:
author: Diego
body: Hello [@???_??_](/t5/user/viewprofilepage/user-id/4250086)! 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:
> * [Confluence Cloud Developer - Advanced searching using CQL](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/)
> * [Confluence Cloud Developer - Rest API examples](https://developer.atlassian.com/cloud/confluence/rest-api-examples/)
> * [Confluence Cloud Developer - Search](https://developer.atlassian.com/cloud/confluence/rest/api-group-search/#api-api-search-get)

I hope this helps!

comments: author: ???_??_
body: Hi, [@Diego](/t5/user/viewprofilepage/user-id/1188952) 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](https://community.atlassian.com/t5/image/serverpage/image-id/139634i8515C1991C30739E/image-size/large?v=v2&px=999 "res.png")


author: Diego
body: 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!


author: ???_??_
body: [@Diego](/t5/user/viewprofilepage/user-id/1188952) 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](https://community.atlassian.com/t5/image/serverpage/image-id/140385iC2D93014D4EC07E6/image-size/large?v=v2&px=999 " qu1.png")

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

Best regards


author: Diego
body: 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!


author: ???_??_
body: [@Diego](/t5/user/viewprofilepage/user-id/1188952) oh, You are really awesome!!

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

Again Thanks!


author: Diego
body: Glad to help!


Tags: cloud

confluence-cloud