# LoRaWAN FUOTA

{% file src="<https://3021047972-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbukLaorfpwzcPSE94T%2Fuploads%2F4PbjjKkL9ixHTVkt1mNb%2FFUOTA.postman_collection.json?alt=media&token=bb5f5606-3c7a-4124-b2f1-c3f26c84484c>" %}

{% hint style="info" %}
Avaliable regions:

0 - EU868

1 - AS923

2 - AU915

3 - US915
{% endhint %}

## Fetch available firmwares for update

*Request URL:*

```
GET /lorawan/fuota/fetch/firmwares/{device_type}
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "firmware_version": "4.2",
                "region": 0,
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
                    }
                }
            },
            {
                "firmware_version": "4.1",
                "region": 0,
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
                    }
                }
            }
        ]
    },
    "total": 2,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
        }
    }
}
```

## Initiate FUOTA

*Request URL:*

```
POST /lorawan/fuota/initiate
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "serial_numbers":["XJPC327253WXM"],
    "version": 4.2,
    "region": 0,
    "fast_fuota": false // true/false
}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "pending",
                "initiatedTime": "2024-02-06 11:33:42",
                "currentVersion": 41,
                "updatingToVersion": "4.2",
                "region": 0,
                "serial_number": "XJPC327253WXM",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/initiate"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/initiate"
        }
    }
}
```

## Fetch FUOTA progress

*Request URL:*

```
GET /lorawan/fuota/fetch/{serial_number}
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Response:*

```
{
    "lorawan": {
        "status": "updating",
        "updatingToVersion": "4.2",
        "currentVersion": 41,
        "lastPacketTime": "2024-02-06T14:15:59.569798008Z",
        "progress": 1,
        "region": 0,
    },
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/5XJ267721HBLP"
        }
    }
}
```

## Fetch FUOTA progress bulk

*Request URL:*

```
POST /lorawan/fuota/fetch/bulk
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

<pre><code>{
<strong>    "serial_numbers":["5XJ267721HBLP","XJPC327253WXM"]
</strong>}
</code></pre>

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "updating",
                "updatingToVersion": "4.2",
                "currentVersion": 41,
                "lastPacketTime": "2024-02-06T14:16:13.880127039Z",
                "progress": 1,
                "region": 0,
                "serial_number": "5XJ267721HBLP",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/bulk"
                    }
                }
            },
            {
                "status": "updating",
                "updatingToVersion": "4.2",
                "currentVersion": 41,
                "lastPacketTime": "2024-02-06T14:12:13.880127039Z",
                "progress": 16,
                "region": 0,
                "serial_number": "XJPC327253WXM",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/bulk"
                    }
                }
            }
        ]
    },
    "total": 2,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/bulk"
        }
    }
}
```

## Stop FUOTA progress bulk

*Request URL:*

```
POST /lorawan/fuota/stop
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "serial_numbers":["5XJ267721HBLP"]
}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "stopped",
                "stoppedTime": "2024-02-06 16:18:26",
                "currentVersion": 42,
                "serial_number": "5XJ267721HBLP",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/stop"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/stop"
        }
    }
}
```
