API pagiantion

Hi,
is it possible to paginate using “Retrieve collection posts” API call? (https://developers.write.as/docs/api/#retrieve-collection-posts)

I am trying to create simple app for printing write.as articles to paper (nothing sophisticated - just fetch article markdown, render it as HTML and apply heavy print-optimized CSS inspired by https://github.com/vladocar/Hartija---CSS-Print-Framework).

However, I need to translate slug of post e.g. blog/we-just-released-a-few-updates-to-write-as-on-the-web to it’s ID. I wanted to do it with enumeration of posts in collection, but it’s seems there is a limit of posts you can enumerate.

TL;DR - how to fetch page 2 in collection or how to translate full slug to ID?

Sounds really cool! I’d love to see / promote that app when you’re finished, if you’d like to share it. But no pressure.

Both these things weren’t supported yet, so I’ve added them to the API. There’s a new endpoint for retrieving a single collection post (which includes the post’s ID), and now you can add a page query parameter (e.g. ?page=2) to the Retrieve collection posts endpoint to get later pages.

2 Likes

Just wanted to bump this topic because I ran into this working with the API. I stumbled upon the page query parameter through trial and error. Before that I consulted the docs and noticed it wasn’t there.

Could we put the page query parameter in the docs to help others using the Retrieve Collection Posts method?

Yep, I’ll make sure this gets added to the documentation :+1:

1 Like

still needs updating, I was going to open an issue but the docs repo doesn’t have issue enabled.

1 Like

I noticed that too. Could we have issues enabled for the API docs @matt?

Great idea – done :slight_smile:

1 Like

Thanks @matt and @robjloranger ! I just opened up the issue here. Feel free to follow through as needed.

2 Likes