Conteúdo do Curso
Introduction to .NET with C#
Introduction to .NET with C#
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
Introduction to APIs
Web Services are a way for the software applications to communicate with each other on the Web. This helps in enabling communication between software systems that are built using different platforms and programming languages. For example, an app written in C# running on our computer can communicate with a website using Web Services.
There are multiple types of Web Services, and it is a broad topic however, we will be focusing on APIs since they are the most common type of Web Services. Moreover, APIs are relevant to learn about at this level.
An API, also known as an Application Programming Interface, is an interface for a client to communicate with a server.
A client is usually an outsider application. Typically, we define a client as a user. However, more specifically, a client is an application, for example, a Web Browser, or a Console Application. A client can also be a part of a single big application that is built in many parts or programming languages.
A server is a computer that hosts the application, which can be a website, a database system, or something else.
In practice, a client messages a server through a Web Request, and the server processes the request and sends a response. We will learn how to send Web Requests in the next chapter.
The Web Request we make to the server is more specifically an HTTP Request. HTTP is a protocol for data communication between a client and a server. An HTTP Request is a message that goes from the client to the server using the HTTP protocol. We don't need to understand how the HTTP protocol works. However, we need to know what kind of HTTP requests are possible. The four most common types of HTTP requests are:
GET
: Retrieve data from the server. It is used for fetching information and should not have any side effects on the server;POST
: Submit data to the server to create a new resource. It often involves updating a database or processing form data;PUT
: Update a resource on the server. It is used to either create a new resource or replace an existing one entirely;DELETE
: Request the removal of a resource on the server. It is used to delete the specified resource.
When a client sends an HTTP request to a server, the client also specifies the HTTP Method in it. HTTP Method is simply the type of request, i.e., GET, POST, PUT, DELETE, etc. It helps the receiving server to appropriately process the request.
A lot of the processing happens on the API part, for example, praising and/or decoding the message from the client.
Tudo estava claro?