Who Needs DELETE?
Explore HTTP verb debates, discover API tools like Bruno and Speakeasy Suggest, and delve into idempotency in APIs.
An interesting tweet made the rounds recently about only using the GET and POST verbs. The main reason is <form>
only supports these two. Taking this further, another tweet states that GET and POST have meaningful behavior differences in the browser. The rest don't. An example was given of how to cancel a reservation. A DELETE request to /reservations/id
makes no sense, and you should use a POST to /reservations/id/cancel
.
Going to be honest, I don't care. If it works for you and it's well-documented, go for it. However, semantics matter in programming, they matter in HTML, and they should matter for HTTP verbs. Browsers are not the only clients of API's. Personally, I would make a PATCH
request to /reservations/id
with the new status in the body. Although I am sure not everyone will agree with that. I wish we could all agree on some solid standards across our industry, but hey, nothing to lose sleep over.
-Alexander
The API Round-Up
Our monthly round-up of articles, news and updates from APIs You Won't Hate and around the web.
Bruno
An excellent little tool called Bruno was recommended to me this week. An open-source API client where collections become first-class citizens, co-located with related information and easily version controlled. It's a rather interesting tool and worth a look.
Automatic OpenAPI Spec Maintenance
Check out Speakeasy Suggest, an AI-powered tool that automatically enhances OpenAPI specifications. Give it an OpenAPI document, and it automatically suggests fixes, applies them, and outputs the modified spec. You can use it via a CLI or GitHub action.
Baselime
I have been building a lot of serverless and edge APIs recently and was looking for a good logging solution when I stumbled across Baselime. It lets you discover events from anywhere in your system and is geared towards serverless setups. I'm underselling it here. Please go check it out.
Hypermedia Factors
A collection of existing Hypermedia Formats. An open wiki of sorts to keep track of all of them. Contributions to keep the list up to date are welcome.
APIs You Won't Hate
The latest from the team at API's You Won't Hate.
Make Your API Idempotent, Avoid Ruining Clients Lives
Phil Sturgeon highlights the value of idempotency in APIs based on a story of accidentally booking three hotel rooms. He advocates for Idempotency Keys in POST requests to prevent such costly mishaps, providing real-world API examples for clarity.
Video: Modern API Tooling for the Entire API Lifecycle
Step into the future of API tooling with this video Phil Sturgeon recorded for Treblle's Hacktoberfest called "Modern OpenAPI Tooling," part of our recent series of OpenAPI tools for every part of the API lifecycle.
From Our Community
Articles written and shared in our free Slack community.
How to Define Union Types in OpenAPI
Nolan Sullivan explores the use of the oneOf
, allOf
, and anyOf
keywords in OpenAPI to create complex, flexible schemas. See why experts recommend using oneOf
for union-type object fields, allOf
for intersection/composite objects, and advises against using anyOf
unless necessary due to potential issues in code generation.
Thanks so much for reading the newsletter. Our membership program helps support the community by covering production and hosting costs for our articles, podcast episodes, and newsletter.
Support APIs You Won't Hate
When you become an member, you'll get access to members-only content while directly supporting our work. Your support helps us to keep making resources for the API community.
Become a member todayThanks so much for your consideration.
Until next time!