News API
POST /news
Description
This API endpoint retrieves a list of news items.
Request Body
The request uses GraphQL to perform the news
query, which does not require any parameters.
Query:
query news {
news {
id
title
description
notifyByEmail
createdAt
updatedAt
}
}
GraphQL Variables:
{}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query news {\n news {\n id\n title\n description\n notifyByEmail\n createdAt\n updatedAt\n }\n}","variables":{}}'
Response:
-
Success (200 OK):
- The response includes a list of news items with their details.
{
"data": {
"news": [
{
"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": 2,
"title": "Maintenance Update",
"description": "Scheduled maintenance will occur on...",
"notifyByEmail": false,
"createdAt": "2024-08-09T08:30:00Z",
"updatedAt": "2024-08-09T08:30: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 there is an issue with the request or a server error, the response will include an error message and status code.
Note:
This endpoint is useful for retrieving current news updates. Ensure to check the notifyByEmail
field if you want to know whether notifications for the news items are sent out.