DEV Community

Discussion on: Writing a dev.to blog post with VSCode

Collapse
 
timdeschryver profile image
Tim Deschryver • Edited

Thanks Ben!
If I encounter something I will definitely create an issue on GitHub 😃

Maybe one thing that took my a couple of minutes, would be to add some kind of validation responses in the response. For example: if the title has not been filled in, the response is 500: Internal Server Error.

curl -X POST -H "Content-Type: application/json" \
-H "api-key: ACCESS_TOKEN" \
-d '{"article": {"body_markdown": "a body"}}' \
https://dev.to/api/articles

But as I'm writing this, I also noticed that the api docs mentioned these validation messages - so it is probably me who's doing something wrong 😅

If you want I can create an issue for this and we can take it from there.

Collapse
 
cbrintnall profile image
Christian Brintnall • Edited

Could still benefit from a proper status code, in this case it sounds like you were missing information, so maybe a 400 is appropriate?

Thread Thread
 
sleeplessbyte profile image
Derk-Jan Karrenbeld

422 would probably be more appropriate, but yes, a 4xx status is the way to go.

Thread Thread
 
timdeschryver profile image
Tim Deschryver

Yes, I think having a 4xx would make these "errors" more understandable for us.