Skip to content
loading...

re: Detecting DEV peak hours via API (bash study) VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Wow. I motivated to build app that get random posts from Dev. I see in docs.dev.to/api/#operation/getArti..., JSON only get 30 posts. Can I reach ...
 

Hi, I think yes, though it is not documented. Source code contains per_page parameter which governs amount of articles in the response.

For example:

dev.to/api/articles/?per_page=3

However, probably it is not good idea to load very large responses (don't know if there is limit). Rather use page parameter to send several requests to different pages. E.g.

dev.to/api/articles/?page=333

 

Then, how to get 10 posts from Dev randomly? 😂

Oh. I got idea:

  • Get number of total posts (eg: 1000)
  • Get 10 number randomly from 0 to 1000

Yep. Good idea! Just exactly what is described in this article above :)

code of conduct - report abuse