The complete documentation for the public API routes can be found here: https://www.cultivointeligente.com.br/api-docs/v4/index.html

In this article you can find a step-to-step guide to support you to get familiarized with our API

Following these steps you will be able to authenticate to Agrosmart API, search for your organization data, search for equipment on your organization and extract data from a module.

All examples are given using curl, but are valid for any other format.

  1. First step is to request access token. You need to send the following request to our platform replacing <E-MAIL> and <PASS> with your own e-mail and password to access Agrosmart platform.

curl -X POST "https://www.cultivointeligente.com.br/api/v4/auth" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"email\": \"<E-MAIL>\", \"password\": \"<PASS>\"}"

2. If e-mail and passwords are correct, we will return a valid token. This token will be used for all future requests to our platform. Keep the token safe. An example of a token is given below:

eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1Njk2MTc0MzYsIklzcyI6IkFncm9zbWFydCIsImF1ZCI6InNwYSIsInVzZXJfaWQiOjF9.iOSXwsd5jZFZlBZ4zB366TSVnqcp-PszbMgq-iwD-XM

3. Right, now you can have access to our API. First step is to find out what is your organization id. All your data will be associated to an organization id. By running the command bellow we will return to you all organizations that your user have access. Just replace <TOKEN> by the token you got on step 2.

curl -X GET "https://www.cultivointeligente.com.br/api/v4/organizations" -H "accept: application/json" -H "Authorization: Bearer <TOKEN>"

The return will look like this:

[
  {
    "id": 123,
    "kind": "rural",
    "name": "My Organization",
    "email": "meuemail@meudominio.com",
    "phone": "+55 35 99999-8888",
    "kind_text": "Produtor Rural",
    "tenant_id": 10
  },
  {
    "id": 321,
    "kind": "rural",
    "name": "Organization from a friend who invited me",
    "email": "emaildoamigo@dominiodoamigo.com",
    "phone": "+55 35 99999-8887",
    "kind_text": "Produtor Rural",
    "tenant_id": 10
  }
]

4. By looking to the response you can find what is your organization ID. From example above we can consider 123. Now, if you are looking for equipment data, you can search for all equipment that are associated with org 123. Just replace <ID> and <TOKEN> on the example below:

curl -X GET "https://www.cultivointeligente.com.br/api/v4/equipments/automatic?organization_id=<ID>" -H "accept: application/json"   -H "Authorization: Bearer <TOKEN>

5. As you can see, the response will be very similar to the one from organizations. You will have the list of all telemetry devices that are associated to the organization. In order to move forward, select one of the ids. We will now look for data from that device.

6. On the example below you can see the filters to search for data from equipment id 123, from organization 321 on the period between 1st Oct 2019 to 15th Oct 2019. The data is grouped by hour.

curl -X GET "https://www.cultivointeligente.com.br/api/v4/equipments/123/measures?organization_id=321&start=01%2F10%2F2019&finish=15%2F10%2F2019&timezone=Etc%2FUTC&group_by=hour" -H "accept: application/json" -H "Authorization: Bearer <TOKEN>"

7. Once the command is sent the response will be all the data available for that equipment on that period. An small extract of data is given below. The variables are given in codes, at the end of the response you will be able to find out the unit and name of each variable.

{"date":"2019-10-14T23:00:00.000Z","bv1_avg":"5.4","bv1_max":"5.4","bv1_min":"5.4","bo1_avg":"0.0","bo1_max":"0.0","bo1_min":"0.0","pl1_sum":"0.0","wg1_avg":"1.0","wg1_max":"1.0","wg1_min":"1.0","ws1_avg":"0.3","ws1_max":"0.5","ws1_min":"0.1","wd1_avg":"25.0","wd1_max":"25.0","wd1_min":"25.0","at1_avg":"24.125","at1_max":"24.9","at1_min":"23.5","ah1_avg":"42.0","ah1_max":"44.0","ah1_min":"40.0","asr1_avg":"0.0","asr1_max":"0.0","asr1_min":"0.0"}],"descriptions":[{"name":"bv1","description":"Tensão da Bateria","unit":"V"},{"name":"bo1","description":"Abertura do Módulo","unit":""},{"name":"pl1","description":"Precipitação","unit":"mm"},{"name":"wg1","description":"Rajada de Vento","unit":"m/s"},{"name":"ws1","description":"Velocidade do Vento","unit":"m/s"},{"name":"wd1","description":"Direção do Vento","unit":"°"},{"name":"at1","description":"Temperatura do Ar","unit":""},{"name":"ah1","description":"Umidade do Ar","unit":"%"},{"name":"asr1","description":"Radiação solar média","unit":"W/m²"}]}

When the request orders for grouped data, the response will provide the max, min and mean values, except for variables that are accumulated such as precipitation.

More info regarding the available commands you can find out on the documentation available at the beginning of this article.

If you have any question, you can contact us by chat or through the following e-mail: suporte@agrosmart.com.br

Did this answer your question?