# Services

In this section you will see how to obtain and store the services of your Wasi website.

# Get all the services

To get the list of all the services in Wasi, you can count on the URI:

api.wasi.co/v1/service/search

This should return a JSON similar to this one:

{
    "0": {
        "id_service": 1,
        "title": "Titulo service 1",
        "abstract": "Resumen service 1",
        "content": "Contenido service 1",
        "image": "https:\/\/images.wasi.co\/servicios\/ejemplo1.png",
        "position": 0
    },
    "1": {
        "id_service": 2,
        "title": "Titulo service 2",
        "abstract": "Resumen service 2",
        "content": "Contenido service 2",
        "image": "https:\/\/images.wasi.co\/servicios\/ejemplo2.png",
        "position": 1
    },
    "2": {
        "id_service": 3,
        "title": "Titulo service 3",
        "abstract": "Resumen service 3",
        "content": "Contenido service 3",
        "image": "https:\/\/images.wasi.co\/servicios\/ejemplo3.png",
        "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 service

To get a service in Wasi, you can count on the URI:

api.wasi.co/v1/service/get/#id_service

For an example service whose id_service is 1, the URI would be:

api.wasi.co/v1/service/get/1

This should return a JSON similar to this one:

{
    "id_service": 3,
    "title": "Titulo service 3",
    "abstract": "Resumen service 3",
    "content": "Contenido service 3",
    "image": "https:\/\/images.wasi.co\/servicios\/ejemplo3.png",
    "position": 3,
    "status": "success"
}

# Add a service

To add a new service in Wasi, you have the URI:

api.wasi.co/v1/service/add

To know which are the parameters that must be sent you can see the section Service 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_service": 2,
    "title": "Titulo service 2",
    "abstract": "Resumen service 2",
    "content": "Contenido service 2",
    "image": "https:\/\/images.wasi.co\/servicios\/ejemplo2.png",
    "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 service

To update a service in Wasi, you have the URI:

api.wasi.co/v1/service/update/#id_service

To know which are the fields that can be updated you can see the section Fields of the services, the fields that we can send as parameter in the table must appear as modifiable.

For example if you want to change the title of the service id_service 3, you must do the following:

api.wasi.co/v1/service/update/3?title=Test title

This should return a JSON like the next one:

{
    "id_service": 2,
    "title": "Titulo test",
    "abstract": "Resumen service 2",
    "content": "Contenido service 2",
    "image": "https:\/\/images.wasi.co\/servicios\/ejemplo2.png",
    "position": 0,
    "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 service

To remove a service in Wasi, you have the URI:

api.wasi.co/v1/service/delete/#id_service

For example, if you want to remove the service with id_service 3, you must do the following:

api.wasi.co/v1/service/delete/3

This should return a JSON like the next one:

{
    "id_service": 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.

Last Updated: 8/3/2020, 9:51:52 PM