# Check a big upload

`GET https://api.mailmasker.org/api/v1/drive/uploads/:id`

How much of an upload has arrived, so you know where to carry on.

- Who can use it: Any signed-in account
- Area: Drive
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/drive-upload-status

`offset` is how many bytes Drive has safely stored, so the next piece starts there. `state` is `open` while bytes are still to come, `completed` once the file is in Drive (the answer then has its `file_id`), or `aborted` if Drive could not store it, in which case start again. Checking also keeps an open upload from being thrown away as abandoned. homelab-cli does this when you run the same upload again after an interruption.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `id` | path | yes | The upload_id from Start a big upload. | `0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f` |

## Good to know

- An upload that isn't yours, or no longer exists, answers 404.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/drive/uploads/0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->get('https://api.mailmasker.org/api/v1/drive/uploads/0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli drive upload ./backup.iso
```

## Response

200 OK:

```json
{
  "upload_id": "0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f",
  "state": "open",
  "offset": 16777216,
  "total_size": 4294967296,
  "filename": "backup.iso",
  "chunk_size": 8388608
}
```
