# Getting started

It is recommended that you read this entire section, as it contains relevant information on the use of login credentials and these are necessary for any interaction with the API in a proper manner.

# Access credentials

For any interaction with the API it is necessary to send the login credentials, this section will explain how to obtain them.

To use the Wasi API you must have a Pro Plan, counting on it please login and go to the menu Configuration / General settings, at the bottom in the Wasi API section you will find the button Generate token, when you click on it, you will get two values with the following format

id_company : #############

And also:

wasi_token : XXXX_XXXX_XXXX_XXXX

❗️ Important

These values will be necessary to make any request to the API.

❗️ Note

If you want to change the access token you can click on the Generate new token button, or if you want to disable API access you can click on the Disable token button.

# Sending the credentials

For any interaction with the API it is necessary to send the login credentials, this section will explain how to do it.

For the following example it will be assumed that you have:

wasi_token : ABCD_EFGH_IJKL_MNOP;

And also:

id_company : 1234567890

Assuming you want to get all the country listings supported by Wasi, according to the documentation, the uri for this is

https://api.wasi.co/v1/location/all-countries

In the case of a GET request you must include at the end of the URI these two parameters as well:

https://api.wasi.co/v1/location/all-countries?id_company=1234567890&wasi_token=ABCD_EFGH_IJKL_MNOP

❗️ Important

For security reasons it is recommended to send as parameters through POST the values of id_company and wasi_token.

❗️ Important

For all requests they must use the HTTPS protocol for security.

# Response obtained

Every time you make a call to Wasi's API, in the answer you will have the status value, this indicates you if the request was successful or something unexpected happened; for the example in the previous section of getting all the countries supported by Wasi, the URI was used:

api.wasi.co/v1/location/all-countries?id_company=1234567890&wasi_token=ABCD_EFGH_IJKL_MNOP

And the expected response would be similar to:

{
    "0": {
        "id_country": "1",
        "name": "Colombia",
        "iso": "CO"
    },
    "1": {
        "id_country": "5",
        "name": "Argentina",
        "iso": "AR"
    },
    "2": {
        "id_country": "9",
        "name": "Belgium",
        "iso": "BE"
    },
    "status": "success"
}

As you can see in the example the status value is success, this means that the request was successful, if not the status value should be error, in this case you will have two extra values, code which is an identifier of the error and message which is a short phrase that indicates why the situation occurs, for example:

{
    "status": "error",
    "code": "0",
    "message": "id_company or wasi_token is wrong."
}

❗️ Note

In this common error the message variable indicates that id_company or wasi_token have a wrong value and should be checked.

❗️ Important

Wasi's API has cached some key requests to give a quick response, this makes some data take a few minutes to refresh.

# Table of errors

The following table shows the classification of possible errors obtained when making an incorrect API call.

Código Tipo Descripción
0 Credentials The values of id_company and wasi_token have a wrong value and should be checked.
1 Permissions You do not have permission to perform the action, for example, when you do not have a Pro plan or when you try to obtain information about a property from a company that is not yet an ally.
2 Validation One or more of the sent parameters has errors.
Last Updated: 8/3/2020, 9:51:52 PM