# Contents
# Get all the contents
To obtain the list of all the contents in Wasi, you can count on the URI
:
api.wasi.co/v1/content/search
This should return a JSON
similar to this:
{
"0": {
"id_content": 1,
"title": "Titulo 1",
"content": "Contenido 1",
"link": "http://demo.localhost/main-contenido-id-1.htm",
"category": 0,
"erasable": true
},
"1": {
"id_content": 2,
"title": "Titulo 2",
"content": "Contenido 2",
"link": "http://demo.localhost/main-contenido-id-2.htm",
"category": 0,
"erasable": false
},
"total": 2,
"status": "success"
}
# Filtering
To filter, the following options apply.
Filter | Type | |
---|---|---|
category | Number | Identifier of the category to which the content belongs. See Categories. |
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 content
To get a content in Wasi, you can count on the URI
:
api.wasi.co/v1/cotent/get/#id_content
For a sample content whose id_content is 1, the URI
would be:
api.wasi.co/v1/content/get/1
This should return a JSON
similar to this:
{
"id_content": 1,
"title": "Titulo 1",
"content": "Contenido 1",
"link": "http://demo.localhost/main-contenido-id-1.htm",
"category": 0,
"erasable": true,
"status": "success"
}
❗️ Note
The erasable field in the JSON
response indicates whether the content was created by the company and can be deleted (true) .
# Add a content
To add new content in Wasi, you have the URI
:
api.wasi.co/v1/content/add
To know which are the parameters that must be sent you can see the section Content 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_content": 2,
"title": "Title content 2",
"content": "Content 2",
"link": "http://demo.localhost/main-contenido-id-2.htm",
"category": 0,
"erasable": true,
"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 content
To update a content in Wasi, you have the URI
:
api.wasi.co/v1/content/update/#id_content
To know which are the fields that can be updated you can see the section Content 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 content with id_content 3, you must do the following:
api.wasi.co/v1/content/update/3?title=Titulo%20test
This should return a JSON
like the next one:
{
"id_content": 2,
"title": "Titulo test",
"content": "Content 2",
"link": "http://demo.localhost/main-contenido-id-2.htm",
"category": 0,
"erasable": true,
"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 content
To remove a content in Wasi, you have the URI
:
api.wasi.co/v1/content/delete/#id_content
For example, if you want to remove the content with id_content 3, you should do the following:
api.wasi.co/v1/content/delete/3
This should return a JSON
like the next one:
{
"id_content": 3,
"status": "success"
}
Only contents that have an erasable field such as true can be deleted, as indicated in the section Contents fields.
❗️ 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.