# News
In this section you will see how to obtain and store the news from your Wasi website.
# Get all the news
To get the list of all the news in Wasi, you can count on the URI
:
api.wasi.co/v1/news/search
This should return a JSON
similar to this one:
{
"0": {
"id_news": 1,
"title": "Titulo noticia 1",
"abstract": "Resumen noticia 1",
"content": "Contenido noticia 1",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo1.png",
"date": "2018-05-11",
"position": 0
},
"1": {
"id_news": 2,
"title": "Titulo noticia 2",
"abstract": "Resumen noticia 2",
"content": "Contenido noticia 2",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo2.png",
"date": "2018-02-30",
"position": 1
},
"2": {
"id_news": 3,
"title": "Titulo noticia 3",
"abstract": "Resumen noticia 3",
"content": "Contenido noticia 3",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo3.png",
"date": "2017-06-05",
"position": 3
},
"total": 3,
"status": "success"
}
# Filtering
To filter, the following options apply.
Filter | Type | |
---|---|---|
query | String | Keywords to perform a search. |
skip | Number | Offset, indicates from where the records are shown, 0 by default (from the beginning, without omitting any). |
take | Number | Limit, number of items to be listed, 10 by default (100 maximum). |
# Get a news item
To get a news item in Wasi, you can count on the 'URI':
api.wasi.co/v1/news/get/#id_news
For a sample news item whose id_news is 1, the URI
would be:
api.wasi.co/v1/news/get/1
This should return a JSON
similar to this one:
{
"id_news": 1,
"title": "Titulo noticia 1",
"abstract": "Resumen noticia 1",
"content": "Contenido noticia 1",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo1.png",
"date": "2018-05-11",
"position": 0,
"status": "success"
}
# Add a news item
To add a new news in Wasi, you can count on the URI
:
api.wasi.co/v1/news/add
To know which are the parameters to be sent you can see the section News fields, the fields that we can send as a parameter in the table must appear as modifiable.
After sending the parameters correctly you should return a JSON
like the one below:
{
"id_news": 2,
"title": "Titulo noticia 2",
"abstract": "Resumen noticia 2",
"content": "Contenido noticia 2",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo2.png",
"date": "2018-02-30",
"position": 0
"status": "success"
}
❗️ Important
Parameters can be sent via GET or via POST, as well as remembering that for all requests it is also necessary to send the access credentials, see Access Credentials.
# Update a news item
To update a news item in Wasi, you have the URI
:
api.wasi.co/v1/news/update/#id_news
To know which are the fields that can be updated you can see the section News fields, the fields that we can send as a parameter in the table must appear as modifiable.
For example if you want to change the title of the news item id_news 3, you must do the following:
api.wasi.co/v1/news/update/3?title=Test title
This should return a JSON
like the next one:
{
"id_news": 2,
"title": "Titulo test",
"abstract": "Resumen noticia 2",
"content": "Contenido noticia 2",
"image": "https:\/\/images.wasi.co\/noticias\/ejemplo2.png",
"date": "2018-02-30",
"position": 1,
"status": "success"
}
❗️ Important
The parameters to be modified can be sent via GET or via POST, as well as remembering that for all requests it is also necessary to send the access credentials, see Access Credentials.
# Delete a news item
To remove a news item in Wasi, you can count on the `URI':
api.wasi.co/v1/news/delete/#id_news
For example if you want to remove the news item with id_news 3, you should do the following:
api.wasi.co/v1/news/delete/3
This should return a JSON
like the next one:
{
"id_news": 3,
"status": "success"
}
❗️ Important
The request can only be sent via POST, as it should be remembered that for all requests it is also necessary to send the access credentials, see Access Credentials.