Why?
I use dev.to as my main dev blogging area now, but I want to show-off my blogs on my portfolio! So we're going to create a simple l...
For further actions, you may consider blocking this person and/or reporting abuse
If it's only 1 specific article you want to extract, you can use
https://dev.to/api/articles/148356
, and replace148356
with the unique post ID. You can then access thetitle
andurl
keys.Still trying to find the easiest way to obtain the unique post ID... however you can use this endpoint
https://dev.to/api/articles?username=nataliedeweerd
and look for the "id" key to find the unique post's ID.See here for more info docs.forem.com/api/#operation/getU...
Hope that helps somewhat... if not, let me know what you're trying to achieve and I'll help further :)
This is awesome
Is it possible to get only 2 latest posts?
Absolutely!
Arrays start from 0, meaning if you want the latest 2, you want to stop when the array key (the index of the array item) reaches 1. So you have 0, and 1. The API automatically orders by newest first, so we just need to tell it when to stop!
In the code above, simply change
if ($key == 2){ break; }
toif ($key == 1){ break; }
Hope that helps :) but let me know if you have anymore questions, or it doesn't make sense.
do we know how we can view the documentation for this API, in terms of query params and such. I'd like to filter out any article which has been archived, or is in Draft format. As when i hit the api, it seems it is returning archived posts aswell.
you can easily do that with this.
const latest2Post = postArray.slice(0, 2);
nice, but how to get the markdown content of each article? any endpoint for that?
Update:
Oh ignore my question above, finally found the answer at dev.to/api
Good job finding the answer! π
Does anyone know how to get this to work with ReactJS?
I am currently stuck on the the request preflight section where I am getting blocked by CORS.
I have not been able to find anything online to help me solve this issue and I would really love to be able to use my API key freely.
Hope someone can help.
dev.to/jrsofty/cors-problem-workar...
I Want to build a mobile client for dev.to
so i wanted to fetch the data in general, and allow the user to log in to their account can anyone help?
also, I am looking for contributors. so feel free to contact me for that too
Really useful article
Glad you found it helpful! :)
Been looking to jumpstart blogging as a developer! This might be really cool to integrate into my portfolio as well. Thanks a bunch :)
Thanks for inspiration. Generally i saw the post using Postman with other programming languages but first time i see the usage of curl instead of Postman to check HTTP Methods.
Is this API limited to only latest 30 blogs? If yes, how to fetch all of them?
Thank you and very helpful. But what if i want to fetch comments from article(s) and get a response with their comments and images so i can display them. Help please.
How we do pagination ,searching and sorting from particular user's article only ,like my articles only ? Is it even possible.
nice post