Why it worked
The video explains a technical concept in a clear and concise manner, using visual aids and direct comparisons to common practices. This approach makes complex information accessible to developers and likely resonated with those seeking efficient API solutions.
Summary
The video introduces the new HTTP Query method as a better alternative to using POST requests for complex data retrieval. It explains that Query requests are read-only, immutable, and cacheable, unlike POST requests which can modify data. The presenter highlights that GET requests with long URLs for complex queries can be cumbersome and hit length limits, making the Query method a more suitable solution.
Structure
- 1Introduction of the new HTTP Query method
- 2Explanation of Query vs. POST for data retrieval
- 3Discussion of Query's read-only, immutable, and cacheable properties
- 4Comparison with GET requests and their limitations
- 5Conclusion on the benefits of the Query method
On-screen text
HTTP METHOD:
QUERY
NEW HTTP METHOD DROPPED WHY
QUERY
QUERY /products
{
"category": "laptops",
"brand": "Apple",
"maxPrice": 2000
}
IT'S CALLED QUERY AND
IT'S FOR WHEN YOU
COMPLEX API REQUEST TO
A SERVER TO GET DATA
THAT WITH A POST REQUEST
POST /products
{
"category": "laptops",
"brand": "Apple",
"maxPrice": 2000
}
QUERY /products
{
"category": "laptops",
"brand": "Apple",
"maxPrice": 2000
}
Property QUERY POST
Read only Yes Potentially No
Idempotent Yes Potentially No
Request Body Undefined Expected
Cacheable Yes (Body + URL) For future GETs (Body + URL only)
LOT OF PEOPLE DO
BUT IT DOESN'T REALLY
BECAUSE A POST REQUEST
ISN'T ALWAYS READ ONLY
QUERY REQUEST
GUARANTEED TO BE READ ONLY
IMMUTABLE AND IT SHOULD
OKAY SO IT'S BASICALLY
A GET REQUEST
GET /products?category=laptops&brand=Apple&maxPrice=2000
GET REQUEST JUST PUT
ALL THE PARAMETERS IN
FOR LONGER OR COMPLEX
QUERIES THIS GETS REALLY ANNOYING
URLS HAVE PRACTICAL LENGTH LIMITS
AND THIS BECOMES IMPOSSIBLE
TO READ AT SOME POINT
OKAY SO IT'S A
GET REQUEST WITH A
YEAH PRETTY MUCH
STILL SEE PEOPLE USING
POST AND GET
AS THIS IS BRAND
NEW AND ISN'T WIDELY
ADOPTED ACROSS THE INDUSTRY YET