pruebas01.dev.cordoba.gob.ar using the WordPress REST API. Items are stored as a custom post type called noticia with all NewsItem fields stored in Advanced Custom Fields (ACF) meta fields.
All API communication is encapsulated in SharedService.
Base URL
Authentication
Every request uses HTTP Basic Authentication with the WordPress application password feature:- Username:
ctrolmedios - Password: WordPress application password (stored in the Angular environment or service configuration)
Authorization header on every request.
Endpoints
GET /wp/v2/noticia — list news items
Fetches persisted news items from WordPress. The application always fetches all available posts by paginating through every page.
Query parameters
Number of posts to return per page. The application uses
100 (the WordPress maximum) to minimise the number of requests.Page number to fetch. Incremented automatically by the pagination logic in
leerNoticias().A
Date.now() timestamp appended to every request URL to prevent the browser from returning a cached response.id (the WordPress post ID) and an acf object holding all NewsItem fields.
Access fields as
item.acf.fieldName. The topic array is not stored; only the semicolon-joined topics string is persisted. Split on ";" to reconstruct the array when reading items back.POST /wp/v2/noticia — create a news item
Creates a new noticia post in WordPress. Called by guardarNoticias() when copyAll() determines that an item does not yet exist in the saved list.
Request body
The post title. Set to the value of
NewsItem.iaResume.The post content body. Always set to the static string
"Contenido enriquecido".WordPress post status. Always
"publish".The full
NewsItem object. All fields are written to ACF custom fields on the post.POST /wp/v2/noticia/:id — update a news item
Updates an existing noticia post in WordPress. Called by ActualizarNoticias() when copyAll() finds a matching post by id_ in the saved list.
Path parameter
The WordPress post ID of the existing
noticia post. Taken from existingPost.id in the saved items list.acf object is the NewsItem spread with the WordPress post id added:
Upsert logic (copyAll())
When an operator dispatches a category from PanelComponent, copyAll() iterates over every item in the current category and applies the following upsert logic:
Look up the item
Search
DataService.noticiasGuardadas for an existing post whose acf.id_ matches the current newsItem.id_.Update if found
If a matching post is found, call
ActualizarNoticias({ ...newsItem, id: existingPost.id }) to overwrite the existing WordPress post.SharedService methods
getPalabrasClave()
Fetches the keyword-to-category mapping from a Google Sheets spreadsheet via the Google Visualization API.
- Returns:
Observable<string>— the raw query response from the Sheets Visualization endpoint - Called by: Application initialisation to populate
DataService.palabrasClaveOriginalandDataService.categorias - Async: Yes — wraps an HTTP GET request in an Observable
guardarNoticias(data)
POSTs a new news item to WordPress.
- Parameters:
data— aNewsItemobject - Returns:
void - Side effects: Creates a new
noticiapost. On success, does not update local state directly; callleerNoticias()afterwards to refreshDataService.noticiasGuardadas.
ActualizarNoticias(data)
POSTs an update to an existing WordPress news item.
- Parameters:
data— aNewsItemextended with anidproperty (the WordPress post ID) - Returns:
void - Side effects: Overwrites the existing
noticiapost at/wp/v2/noticia/:id.
leerNoticias()
Fetches all persisted news items from WordPress, paginating through every available page.
- Returns:
Observable<any[]>— emits a single array containing every post across all pages once pagination is complete - Pagination: Fetches page 1, checks if the result length equals
per_page(100). If so, increments the page counter and fetches again, concatenating results. Stops when a page returns fewer than 100 items.
leerNoticias() converts the paginated Promise chain into an RxJS Observable using from(). Subscribe to the returned Observable to receive the full result array. The nocache timestamp query parameter ensures WordPress does not serve a cached response.