> For the complete documentation index, see [llms.txt](https://tankguide.gitbook.io/fullup-technics-public/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tankguide.gitbook.io/fullup-technics-public/introduction-general-overview.md).

# FULLUP API Manual

## How to start using our Public API

If you want to use our APIs in order to get updates on your data, you have two options to quickly get started.

### Option A. Try our Postman Collection

Do you want to quickly get a feeling about how our api works? Just import our postman collection from the following link. Play with it and integrate.

<https://www.getpostman.com/collections/ea00e396356ef31fc3d3>

### Option B. Understand our API from the documentation

{{url}} = <https://api.fullup.be>

## Generate tokens

<mark style="color:green;">`POST`</mark> `{{url}}/auth/generate`

Use this method to generate the token you will use in other requests

#### Query Parameters

| Name     | Type   | Description        |
| -------- | ------ | ------------------ |
| password | string | Your password      |
| email    | string | Your email address |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "result": {
        "type": "bearer",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU3OGNiMWYxOWJkZDgwNTc3OGYzZmZkYyIsInV1aWQiOiJlMjA2MzVkYS03ZmU0LTQzM2EtYmMzMy1mZjkyNWFkM2FkNTIiLCJ0b2tlbl90eXBlIjoiYmVhcmVyIiwiaWF0IjoxNTgzNzcyODEyLCJleHAiOjE1ODQ5ODI0MTJ9XXXXXXXXXXXXXXXXXXXX",
        "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU3OGNiMWYxOWJkZDgwNTc3OGYzZmZkYyIsInV1aWQiOiJlMjA2MzVkYS03ZmU0LTQzM2EtYmMzMy1mZjkyNWFkM2FkNTIiLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImlhdCI6MTU4Mzc3MjgxMiwiZXhwIjLHLKJHLKJHLKJHXXXXXXXXX",
        "token_expiration_date": "2020-03-23T16:53:32.545Z",
        "refresh_token_expiration_date": "2020-04-06T16:53:32.545Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Get IDs of tanks

<mark style="color:blue;">`GET`</mark> `{{url}}/loginApi?email=$email&password=$password`

This command is used to generate tokens in order to further use the get tanks methods

#### Query Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| email    | string |             |
| password | string |             |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "result": [
        "576919af5XXXXXXXXXXXXXXX",
        "59a000c9fXXXXXXXXXXXXXXX",
    ]
}
```

{% endtab %}
{% endtabs %}

## Get Tank Info

<mark style="color:blue;">`GET`</mark> `{{url}}/tanks_public/:id`

This API call provides you all the informations about a specific tank you own. Please note that you can only collect data about tanks if you are the owner.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Tank ID     |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bear token       |
| Content-Type  | string | Application/json |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "result": {
        "address_street": "Street",
        "address_number": "1",
        "address_box": "1",
        "address_postcode": "1000",
        "address_city": "Brussels",
        "address_country": "Belgium",
        "owner_email": "demotank@fullup.be",
        "device_full_serial": "sigfox_XXXX3",
        "tank_id": "5db07c8036c612593f364d1b",
        "tank_name": "Ma citerne",
        "tank_usage": "fuel",
        "tank_diameter": null,
        "tank_height": 200,
        "tank_length": 100,
        "tank_chimney": 3,
        "tank_shape": "cuboid",
        "tank_total_volume": 2000,
        "tank_notification_level": 50,
        "last_measure_date": "2020-03-10T09:00:01.184Z",
        "current_volume": 1580,
        "current_temperature": 1.9,
        "estimated_volume": 1580,
        "last_connection_date": "2020-03-10T09:00:01.239Z"
    }
}
```

{% endtab %}
{% endtabs %}

Remarks:

* Currently, for security reasons you only get access to the tanks where you are set up as owner
* For customisations, just change the {{url}} variable. If you are not sure about which URL to use, contact us (<support@fullup.be>)
* If you need access to specific functionalities, contact us (<support@fullup.be>)

## GET last tank data

<mark style="color:blue;">`GET`</mark> `{{url}}/tanks/:id/data`

GET the last 3 days of data

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | TANK ID     |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Content-type  | string | Application Json |
| Authorization | string | Bearer token     |

{% tabs %}
{% tab title="200 Results contains the last entries sent by the measuring device." %}

```
{
  "success": true,
  "result": [
    {
      "tank": "5e8f185d263d46c0775b140c",
      "date": "2020-07-14T10:48:36.261Z",
      "serial": "sigfox_2F7213",
      "sbatt": 64920,
      "temperature": 22.8,
      "distance": 79,
      "src": "10",
      "validated": true,
      "log_id": "5eccf4040448f7a4079d4c46",
      "volume": 7299,
      "id": "5eccf404d5c30d04221da62b"
    }
  ],
  "nb_total": 105
}
```

{% endtab %}
{% endtabs %}
