Junior — Middle
Can you list the main types of HTTP requests used when interacting with web services?
sobes.tech AI
Answer from AI
Main types of HTTP requests used when interacting with web services:
- GET — request to retrieve data from the server.
- POST — send data to the server to create a new resource.
- PUT — update an existing resource on the server.
- DELETE — delete a resource on the server.
- PATCH — partial update of a resource.
- HEAD — retrieve only the response headers without the body.
Example of usage in C# with HttpClient:
using var client = new HttpClient();
var response = await client.GetAsync("https://api.example.com/data");
string content = await response.Content.ReadAsStringAsync();