+ 1
GET/POST Requests
I've already studied all the sololearn REST API lesson, studied Request / Response, and know the difference between GET and POST However what I do not understand is: -when to know exactly when and which site calls for a GET and a POST? - What is the professional use of REST APIs like Postman software? - What are the headers (example: User-Agent) - How does a site declare parameters in the URL to change content (eg, the site adds (?lang=EN_US) in the URL and the content is in English)?
1 ответ
+ 5
So basically I have answers for 3 of your questions.
1.) See, GET request is used for requesting server to get give us some data. And POST request is used to request server to store some data.
2.) This is also an example of what get and post actually is, While you use Node.js if you have a blog page and you want to display all blog posts from database then you do a GET request to server and get all posts. And if you want to upload a post then you do a POST request to store that blog.
3.) I don't know 😅
4.) Those are URL parameters, there are different ways in different languages to pass them, in html you do like this
<a href="somesite.html?lang=eng">Site</a>
After that in php you have to do like this : $_GET['lang']; so you will get value of it.