Prepin
Log in

Create APIs for commenting on Facebook Live.

Approach / Explanation

This prompt requires you to develop the application programming interfaces (APIs) for the comment functionality in Facebook Live. Facebook Live enables users to stream video live to their friends or followers, who can comment while viewing. In designing these APIs, consider essential features such as creating comments, fetching comments, modifying comments, and removing comments. Additionally, you should address the challenges associated with a live commenting system, including handling large data volumes, ensuring real-time updates, and safeguarding privacy and security.

Suggested Answer

Here is an illustration of an API structure for Facebook live commenting: Create Comment API (POST /api/comments) This API should take the user ID, live video ID, and comment text as input parameters. It should respond with the ID of the newly created comment. Get Comments API (GET /api/comments) This API should accept the live video ID as a parameter and return a list of comments. To manage large volumes of comments, pagination can be implemented, allowing for a limited number of comments to be returned with each request. Update Comment API (PUT /api/comments/:id) This API should take the comment ID as a parameter along with the updated comment text. It should return the modified comment. Delete Comment API (DELETE /api/comments/:id) This API should take the comment ID as a parameter to delete the comment. It should return a confirmation indicating that the comment has been removed. It is important to remember that when designing these APIs, user permissions should be taken into account. For instance, users should only be allowed to update or delete their own comments.

Alternative Answer

Here’s another illustration: Create Comment API (POST /api/liveVideos/:liveVideoId/comments) This API takes the live video ID and the comment text in the request body and should return the ID of the newly created comment. Get Comments API (GET /api/liveVideos/:liveVideoId/comments) This API requires the live video ID and returns all comments associated with that video. To manage large numbers of comments effectively, consider implementing a method to retrieve comments in batches, such as cursor-based pagination. Update Comment API (PUT /api/comments/:commentId) This API takes the comment ID along with the new comment text in the request body. It should permit users to edit only their own comments and return the updated comment. Delete Comment API (DELETE /api/comments/:commentId) This API accepts the comment ID and removes the comment from the database. It should only permit users to delete their own comments and provide a confirmation upon deletion. It is essential to uphold user permissions when creating these APIs. Additionally, to facilitate real-time updates, consider utilizing WebSocket or similar technologies.

Question Details

Difficulty & Category

Medium
system design

Companies

Meta (Facebook)

Product

For CandidatesFor RecruitersCompaniesBrowse JobsInterview QuestionsDeep ProfileSkill AssessmentOpportunity Matching
Prepin.ai

© 2026 Prepin LLC · Philadelphia, PA · All rights reserved.