Skip to main content

Delete News API

POST /deleteNews

Description

This API endpoint allows an admin to delete an existing news item by providing the news item's unique identifier. Deleting a news item will remove it and its associated data from the platform.

Request Body

The request utilizes GraphQL to perform the deleteNews mutation.

Mutation:

mutation deleteNews ($id: Int!) {
deleteNews (id: $id) {
id
title
description
notifyByEmail
createdAt
updatedAt
}
}

Variables:

{
"id": 0
}
  • id (Int): The unique identifier of the news item to be deleted.

Response:

  • Success (200 OK):

    • If the deletion is successful, the response will return the details of the deleted news item, confirming that the news item has been removed from the platform.
    {
    "data": {
    "deleteNews": {
    "id": "<News_ID>",
    "title": "<News_Title>",
    "description": "<News_Description>",
    "notifyByEmail": "<Notify_By_Email>",
    "createdAt": "<Creation_Timestamp>",
    "updatedAt": "<Update_Timestamp>"
    }
    }
    }
  • Error (4XX/5XX):

    • Appropriate error messages and status codes will be returned in cases of invalid news ID, missing required fields, or server errors.

Note:

Ensure that the id corresponds to an existing news item within the platform. Once deleted, the news item and its data cannot be recovered, so make sure to back up any necessary information before performing this action. This API should be used by admins with the necessary permissions to manage and delete news items within the platform.