Thanks for the intro. But I was wondering, why don’t just use a post request with the body in every case? That way it could make the code more simple no?
Short answer is that you can use a POST request for every case. If you are writing a HTTP/REST API and you will be calling that API from another application of yours then you can use POST request for everything. However, there are norms, conventions, best practices that people like to follow because it isn’t always just you working alone. When you are working for an employer with many other programmers, there will always be atleast one programmer who will question you for not following the conventions. For example, when an API’s job is to only return data and you decide to use POST method in your API instead of GET then others may ask you to justify why you used POST since it a general understanding that GET method is for data retrieval and POST request are used to change the state of the data on the server. Hope this answers your question.
I don't think I've said anything like that in the video, have I? I'll double check the video. You are correct, GET request shouldn't have a request body
Text version of this video is available here: www.apioncloud.com/http-headers-path-variables-query-parameters-body.html
I found this video very useful. Thank you for providing this content.
Thank you for leaving a comment and I am glad that you found this video useful.
I'm new to APIs and have been struggling to understand the difference between headers, body, path. Very helpful. Thank you.
I am glad that you found this video helpful. Thank you.
Straightforward and simple. Thank you.
I learn so much from this. Well done. 🙏
Thank you, I’m glad that you found this video useful.
Thank you for breaking out this information and best practices!
Glad that you found the video useful.
Precise and straight to the point
Thank you!
Excellent information
Glad you liked it
it was really quite precise and much informative.
Glad that you found it informative. Thank you!
Great explanation with examples 👏
Thank you and I appreciate the feedback.
excellent explanation ,well done
Glad you found the explanation useful. Thank you!
You're doing a great job man. Thank you.
I appreciate that!
really useful video thanks a lot!
Glad that found this video useful.
thank you this helped me
You're welcome!
Superb!!!!
Thanks a lot
Thanks for the intro. But I was wondering, why don’t just use a post request with the body in every case? That way it could make the code more simple no?
Short answer is that you can use a POST request for every case. If you are writing a HTTP/REST API and you will be calling that API from another application of yours then you can use POST request for everything.
However, there are norms, conventions, best practices that people like to follow because it isn’t always just you working alone. When you are working for an employer with many other programmers, there will always be atleast one programmer who will question you for not following the conventions. For example, when an API’s job is to only return data and you decide to use POST method in your API instead of GET then others may ask you to justify why you used POST since it a general understanding that GET method is for data retrieval and POST request are used to change the state of the data on the server.
Hope this answers your question.
amazingggg
Thanks!
how come GET request cant have body?
I don't think I've said anything like that in the video, have I?
I'll double check the video. You are correct, GET request shouldn't have a request body