To prevente the abuse of web scraper on dev.to i want to share what i learn about the dev.to v0 api.
Articles
- https://dev.to/api/articles get a list of the latest 30 articles with tags career, discuss and productivity (it seems to be the default list of tags)
- https://dev.to/api/articles?tag=react get the latest 30 articles tagged with react
- https://dev.to/api/articles?page=23&tag=react get the 30 articles at page 23 tagged with react
- https://dev.to/api/articles?username=alfredosalzillo get the latest 30 articles of the user with username alfredosalzillo
Users
- https://dev.to/api/users/by_username?url=alfredosalzillo get the info of the user with username alfredosalzillo
- https://dev.to/api/users/149157 get the info of the user with id 149157
- https://dev.to/api/users/?state=follow_suggestions get a list of follow suggestions
- https://dev.to/api/users/?state=sidebar_suggestions&tag=react i don't now what this really do
- https://dev.to/api/users/by_username get an user with a null username, i think this is a bug.
Tags
- https://dev.to/api/tags get the list of the latest 10 tags
- https://dev.to/api/tags?page=2 get the list of the 10 tags at page 2
Top comments (11)
Hey Alfredo, thanks for the resource. Did you gather this info by guessing and checking or did you look at the source? github.com/thepracticaldev/dev.to/...
In either case, do you know if there's a way to look up a user by Github username?
Seems like this is where the magic happens, but I don't know how to read Ruby: github.com/thepracticaldev/dev.to/...
Thanks for putting this all in one spot Alfredo!
Hi, how do I get the content of the article?
to get the content of an article
dev.to/api/articles/{articleID}
for example, for this article
dev.to/api/articles/94179
How can I get all articles of specific user?
All API return paged lists, the only way to get all the articles of a user is to call dev.to/api/articles?username={user... until the reply is an empty array.
Is it possible to get users by location?
For all, I have found the openapi3.0 definitions of all the API and have created a swagger website.
dev-to-swagger
Is it possible to get the articles in created_at desc? Or do I need to sort it myself??
It's not possible, as today you can only get articles by published_at desc based on the top query parameters
Thanks for this - very interesting. If you have a spare moment, could you tell me how to find the articleID for a post please?