Sobes.tech
Junior — Middle

When is the HTTP GET method used to send requests?

sobes.tech AI

Answer from AI

The HTTP GET method is used to retrieve data from a server without changing the state of the resource. It is used when you need to request information, such as loading a webpage, fetching data from an API, or downloading a file. In a GET request, parameters are passed in the URL, and the request should be idempotent and safe, meaning it should not modify data on the server.

Example of a GET request using Python and the requests library:

import requests
response = requests.get('https://api.example.com/data', params={'id': 123})
print(response.json())