Skip to content

Block user endpoint

Alvin Cheng edited this page Apr 23, 2023 · 2 revisions

Description

The block user endpoint is used for blocking a user by changing the 'blocked' element in the MongoDB database. The endpoint will return a status of '200' on success, '401' on invalid API key, '400' on invalid user or '500' on an internal server error. You may find the source file of this endpoint in /src/endpoints/blockUser.ts. Furthermore, the 'user' argument is the user to target and apply the effect to, and the 'blockStatus' argument is the status of the user to be changed in the 'blocked' element.

Example

post("http://<URL>/api/block_user?key=<YOUR_API_KEY>", {
  user: "<TARGET_USER>",
  blockStatus: true, // Boolean value
})
  .then((res) => {
    console.log(res);
  })
  .catch((err) => {
    console.error(err);
  });
Clone this wiki locally