News by ID API
POST /newsById
Description
This API endpoint retrieves a specific news item based on its ID.
Request Body
The request uses GraphQL to perform the newsById
query, which requires the id
parameter.
Query:
query newsById ($id: Int) {
newsById (id: $id) {
id
title
description
notifyByEmail
createdAt
updatedAt
}
}
GraphQL Variables:
{
"id": 0
}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query newsById ($id: Int) {\n newsById (id: $id) {\n id\n title\n description\n notifyByEmail\n createdAt\n updatedAt\n }\n}","variables":{"id":0}}'
Response:
-
Success (200 OK):
- The response includes the details of the requested news item.
{
"data": {
"newsById": {
"id": 1,
"title": "New Feature Release",
"description": "We are excited to announce the release of a new feature...",
"notifyByEmail": true,
"createdAt": "2024-08-10T10:00:00Z",
"updatedAt": "2024-08-10T10:00:00Z"
}
}
}id
: Unique identifier for the news item.title
: Title of the news item.description
: Description of the news item.notifyByEmail
: Boolean indicating if notifications about this news item will be sent via email.createdAt
: Timestamp when the news item was created.updatedAt
: Timestamp when the news item was last updated.
-
Error (4XX/5XX):
- If the ID is invalid or there is a server error, the response will include an error message and status code.
Note:
This endpoint is useful for retrieving details of a specific news item using its ID. Make sure the id
parameter is correctly specified to get accurate results.