Complete the code to specify the HTTP method for retrieving data.
response = requests.[1]('https://api.example.com/data')
The GET method is used to request data from a server without changing it.
Complete the code to specify the HTTP method for creating a new resource.
response = requests.[1]('https://api.example.com/data', json=payload)
The POST method is used to send data to the server to create a new resource.
Fix the error in the HTTP method used to update a resource fully.
response = requests.[1]('https://api.example.com/data/123', json=updated_data)
The PUT method is used to fully update an existing resource.
Fill both blanks to partially update a resource and specify the correct HTTP method.
response = requests.[1]('https://api.example.com/data/123', json=[2])
The PATCH method is used for partial updates, and data is the variable holding the update info.
Fill all three blanks to delete a resource and check the response status code.
response = requests.[1]('https://api.example.com/data/123') if response.status_code == [2]: print('[3]')
The DELETE method removes a resource. A 204 status means success with no content. The message confirms deletion.