Overview
The Noticias API allows you to manage news articles in the MTB Backend system. Each article includes a title, slug, main image, summary, content, publication date, author, and publication status.
This endpoint supports draft and publish functionality. Use the publishedAt field to control publication status.
List All Noticias
Retrieve a list of all news articles with optional filtering, sorting, and pagination.
Query Parameters
Filter articles by field values. Example: filters[publicado][$eq]=true
Sort articles by field(s). Example: fecha:desc for newest first
Page number for pagination
Populate relations. Use * for all relations or specify fields like imagenPrincipal
Response
Array of noticia objects Unique identifier for the article
Title of the news article
URL-friendly slug generated from the title
Brief summary of the article
Full article content in blocks format
Publication date of the article
Name of the article author
Whether the article is published
Publication timestamp (null if draft)
Example Request
curl -X GET "https://api.example.com/api/noticias?populate=*&sort=fecha:desc&filters[publicado][ $eq ]=true" \
-H "Content-Type: application/json"
Example Response
{
"data" : [
{
"id" : 1 ,
"attributes" : {
"titulo" : "Gran Evento de MTB 2024" ,
"slug" : "gran-evento-de-mtb-2024" ,
"resumen" : "Se anuncia el evento más importante del año en el mundo del mountain bike." ,
"contenido" : [
{
"type" : "paragraph" ,
"children" : [
{ "type" : "text" , "text" : "El próximo mes se llevará a cabo..." }
]
}
],
"fecha" : "2024-01-20" ,
"autor" : "Juan Pérez" ,
"publicado" : true ,
"imagenPrincipal" : {
"data" : {
"id" : 1 ,
"attributes" : {
"url" : "/uploads/evento_mtb.jpg" ,
"alternativeText" : "Evento MTB"
}
}
},
"publishedAt" : "2024-01-20T10:00:00.000Z" ,
"createdAt" : "2024-01-15T10:00:00.000Z" ,
"updatedAt" : "2024-01-20T10:00:00.000Z"
}
}
],
"meta" : {
"pagination" : {
"page" : 1 ,
"pageSize" : 25 ,
"pageCount" : 1 ,
"total" : 1
}
}
}
Get a Single Noticia
Retrieve a specific news article by its ID.
Path Parameters
The unique identifier of the article
Query Parameters
Populate relations. Use * for all relations or specify fields like imagenPrincipal
Response
The noticia object (see List All Noticias for structure)
Example Request
curl -X GET "https://api.example.com/api/noticias/1?populate=*" \
-H "Content-Type: application/json"
Example Response
{
"data" : {
"id" : 1 ,
"attributes" : {
"titulo" : "Gran Evento de MTB 2024" ,
"slug" : "gran-evento-de-mtb-2024" ,
"resumen" : "Se anuncia el evento más importante del año en el mundo del mountain bike." ,
"contenido" : [ ... ],
"fecha" : "2024-01-20" ,
"autor" : "Juan Pérez" ,
"publicado" : true ,
"imagenPrincipal" : { ... },
"publishedAt" : "2024-01-20T10:00:00.000Z" ,
"createdAt" : "2024-01-15T10:00:00.000Z" ,
"updatedAt" : "2024-01-20T10:00:00.000Z"
}
}
}
Create a Noticia
Create a new news article.
Request Body
Title of the news article
URL-friendly slug (auto-generated from title if not provided)
ID of the uploaded main image media file
Brief summary of the article
Full article content in blocks format
Publication date (YYYY-MM-DD format)
Name of the article author
Whether the article is published
Response
The created noticia object
Example Request
curl -X POST "https://api.example.com/api/noticias" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"data": {
"titulo": "Nueva Ruta de MTB Inaugurada",
"resumen": "Se inaugura una nueva ruta de mountain bike en la región.",
"contenido": [
{
"type": "paragraph",
"children": [{"type": "text", "text": "La nueva ruta ofrece 15 km de pistas..."}]
}
],
"fecha": "2024-01-25",
"autor": "María González",
"publicado": true
}
}'
Example Response
{
"data" : {
"id" : 2 ,
"attributes" : {
"titulo" : "Nueva Ruta de MTB Inaugurada" ,
"slug" : "nueva-ruta-de-mtb-inaugurada" ,
"resumen" : "Se inaugura una nueva ruta de mountain bike en la región." ,
"contenido" : [ ... ],
"fecha" : "2024-01-25" ,
"autor" : "María González" ,
"publicado" : true ,
"imagenPrincipal" : { "data" : null },
"publishedAt" : "2024-01-25T10:00:00.000Z" ,
"createdAt" : "2024-01-25T10:00:00.000Z" ,
"updatedAt" : "2024-01-25T10:00:00.000Z"
}
}
}
Update a Noticia
Update an existing news article by its ID.
Path Parameters
The unique identifier of the article to update
Request Body
Noticia fields to update (same structure as Create)
Response
The updated noticia object
Example Request
curl -X PUT "https://api.example.com/api/noticias/1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"data": {
"titulo": "Gran Evento de MTB 2024 - Actualizado",
"publicado": false
}
}'
Example Response
{
"data" : {
"id" : 1 ,
"attributes" : {
"titulo" : "Gran Evento de MTB 2024 - Actualizado" ,
"slug" : "gran-evento-de-mtb-2024" ,
"resumen" : "Se anuncia el evento más importante del año en el mundo del mountain bike." ,
"contenido" : [ ... ],
"fecha" : "2024-01-20" ,
"autor" : "Juan Pérez" ,
"publicado" : false ,
"imagenPrincipal" : { ... },
"publishedAt" : "2024-01-20T10:00:00.000Z" ,
"createdAt" : "2024-01-15T10:00:00.000Z" ,
"updatedAt" : "2024-01-25T11:00:00.000Z"
}
}
}
Delete a Noticia
Delete a news article by its ID.
Path Parameters
The unique identifier of the article to delete
Response
The deleted noticia object
Example Request
curl -X DELETE "https://api.example.com/api/noticias/1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Example Response
{
"data" : {
"id" : 1 ,
"attributes" : {
"titulo" : "Gran Evento de MTB 2024 - Actualizado" ,
"slug" : "gran-evento-de-mtb-2024" ,
"resumen" : "Se anuncia el evento más importante del año en el mundo del mountain bike." ,
"contenido" : [ ... ],
"fecha" : "2024-01-20" ,
"autor" : "Juan Pérez" ,
"publicado" : false ,
"imagenPrincipal" : { ... },
"publishedAt" : "2024-01-20T10:00:00.000Z" ,
"createdAt" : "2024-01-15T10:00:00.000Z" ,
"updatedAt" : "2024-01-25T11:00:00.000Z"
}
}
}
Important: Deleting a news article is permanent and cannot be undone. Consider unpublishing articles instead by setting publicado to false.