API Model for Messenger Service
Learn about the main data entities and API endpoints needed to build a chat service like Messenger.
We'll cover the following...
In the previous lesson, we decided on the architectural aspects of designing the Messenger API’s communication protocols and data formats. In this lesson, we will describe the endpoints, data entities, and the message format required for a chat between clients.
Base URL and API endpoints
We will use the following URL for designing the Messenger API. The api.messenger.com
is the host URL followed by the version v1.0
and the service.
The following illustration represents the operations and their associated endpoints:
Let's go over the purpose of the endpoints below:
WebSocket connection: This endpoint is used to establish a WebSocket connection with a chat server.
Retrieve or upload an asset: This endpoint is accessed to retrieve or upload a media file.
Retrieve a paginated list of messages: These endpoints are targeted to retrieve a paginated list of messages.
Remember: We don't have an endpoint for a live and offline chat because we use WebSockets for such communication. We will shortly see how that interaction between users takes place.
The message format for API endpoints
In this section, we’ll discuss data entities, requests, and response structures for each functional requirement. We will also look at how a WebSocket connection is established to send one-to-one messages. Let's ...