Quickstart

Ayyeka provides a REST-API to allow you to integrate the Ayyeka FAI platform into any application. Using REST-API, users will be able programmatically to retrieve and analyze field data, as well as monitor and manage Walvelets and more.

To make a call to Ayyeka REST API, you need an API Key and Secret. Go to the API page of the FAI platform by clicking the API icon on the top nav bar. Then go to the "API Clients" tab.

Click "Generate API Key", and generate the API Key and Secret to going to use shortly.

Ayyeka uses oAuth2 client-credentials authentication flow for authentication; learn more about it on the API Authentication page. Therefore, you will need to get the access token first in order to call the REST-API.

Format the APIKey:APISecret in base 64 format.

#> echo APIKey:APISecret | base64

Call FAI Platform oAuth2 authorization service to receive the Bearer Token.

curl --location --request POST 'https://restapi.ayyeka.com/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic APIKeySecretInBase64' \
--data-urlencode 'grant_type=client_credentials'

oAuth2 authorization service will return a JSON response:

{
    "access_token": "JWT.ACCESS.TOKEN",
    "token_type": "JWT",
    "expires_in": 3600
}

The access_token value is your JWT access token. Include it in the Authorization header in your HTTP request.

curl --request GET \
     --url https://restapi.ayyeka.com/v2.0/site \
     --header 'accept: application/json' \
     --header 'authorization: Bearer JWT.ACCESS.TOKEN'

The FAI RestAPI returns a JSON response with a list of all sites in your account/organization:

[  
    {
        "id": 16828,
        "creation_date": "2020-11-19T18:29:42Z",
        "display_name": "AIFC Demo Island Wastewater: CSO, Level and Flow",
        "status": "Active",
        "longitude": "178.082886",
        "latitude": "-18.093644"
    },
    {
        "id": 16829,
        "creation_date": "2020-11-19T18:32:54Z",
        "display_name": "AIFC Demo Island Wastewater: Quality",
        "status": "Active",
        "longitude": "177.458038",
        "latitude": "-17.603448"
    },
    {
        "id": 16830,
        "creation_date": "2020-11-19T18:36:56Z",
        "display_name": "AIFC Demo Island Wastewater: Tank Level",
        "status": "Active",
        "longitude": "177.981262",
        "latitude": "-17.651874"
    }
]

What’s Next