Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Confluence API - How to order content by lastmodified date?

Hiya All,


I am currently trying to integrate with the Confluence API, to get wiki content pages to be used in a separate application. As part of this integration, I need to query content pages, and get pages updated within the last 24 hours, which is where to issue is occurring. I am getting errors when attempting to order by, or filter by the last modified date.

I have outlined more details below.

The Goal:

The Issue:

  • When using the below call, I am seeing a 400 error with the message 'com.atlassian.confluence.api.service.exceptions.BadRequestException: Unsupported orderBy field: history.lastUpdated desc'.
    • https://{{my domain}} desc
  • An alternative approach that was tried was the search endpoint, and CQL, but this returns another error, detailed below.
    • https://{{my domain}} = page and lastmodified > startOfWeek()
    • Error: "com.atlassian.confluence.api.service.exceptions.SSStatusCodeException: CQL was parsed but the search manager was unable to execute the search. Error message: com.atlassian.confluence.api.service.exceptions.SSStatusCodeException: There was an illegal request passed to XP-Search Aggregator API : HTTP/1.1 403 Forbidden"
Any assistance is much appreciated.

2 answers

1 accepted

0 votes
Answer accepted

After more testing an experimentation, I have managed to achieve the desired goal using the search endpoint. The original issue was due permissions on the account making the call.

When using another account with increased permissions, I was able to make the below call, using an encoded object for the query itself.

https://{{my domain}}{{content ID}}%2C%22contentStatuses%22%3A%5B%22current%22%5D%2C%22spaceKey%22%{{space key}}%7D&cql=type%3Dpage%20and%20lastModified%3Enow%28%27-1d%27%29&

pre-enconding = {"contentId":{{content id}},"contentStatuses":["current"],"spaceKey":{{space key}}}

0 votes
Juan Carlos Vera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 21, 2023

hi @Ben Loseby ,

try with something like this:

https://{{your domain}}

Hi @Juan Carlos Vera ,

Thanks for getting back to me.

I have just tried the above, and whilst it does not error, the API seems to be ignoring the orderBy, and still order the results by createDate in ascending order.

I tested by trying to order using the createdDate, with the below, and even then it seems to ignore the direction specified:

  • /wiki/rest/api/content?orderby=createdDate%20Desc&expand=history
    • Note: "orderby" uses lowercase b
    • Attempted with both "desc" and "Desc" 
    • Errors claiming "Unsupported orderBy direction: createdDate Desc"
  • /wiki/rest/api/content?orderBy=createdDate%20Desc&expand=history
    • Note: "orderBy" uses uppercase B
    • Attempted with both "desc" and "Desc"  
    • Doesn't error but order by direction is ignored
  • /wiki/rest/api/content?orderBy=lastmodified%20desc&expand=history
    • Note: "orderBy" uses uppercase B
    • Attempted with both "desc" and "Desc"  
    • Doesn't error but order by direction is ignored
  • /wiki/rest/api/content?orderby=lastmodified%20desc&expand=history
    • Note: "orderby" uses lowercase b
    • Attempted with both "desc" and "Desc" 
    • Errors claiming "Unsupported orderBy field: lastmodified desc"

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events