Forums

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

how to grab only the latest blog post

Erik Mathis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 9, 2019

I able to find the lat blogpost using:

 posts = confluence.get_all_pages_from_space( config.atlassianSpace,  content_type='blogpost',  start=0,  limit=99999999, expand='version' )

I've tried changing start, limits to the likes of (-1).

 

Is there an existing method to just get the latest post? 

1 answer

0 votes
Hermance NDounga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 10, 2019

Hello Erik,

I'm not sure where you want to display this but if it's in a Confluence page, you can simply use the macro blogpost, display only one blog post and order by creation date. 

Is your use case different? 

Cheers

Erik Mathis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 10, 2019

Thanks!

 

Is that macro and ordering available via the api?

Hermance NDounga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 10, 2019

hum am I not an API pro user I have to admit :D 
But I guess by using the command get content, specify the type blog, limit it to one, could work, or using the search command, writing the cql so you specify also the type, limit it to 1 and since it's a cql comment you can order it by last created, i think it should work even better. 

https://docs.atlassian.com/ConfluenceServer/rest/7.1.0/#api/content-search

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events