# Get deployment size

**URL:** https://hub.mender.io/t/get-deployment-size/2206
**Category:** General Discussions
**Created:** [July 17, 2020, 10:46pm UTC](https://hub.mender.io/t/get-deployment-size/2206 "2020-07-17T22:46:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![msaenger](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@msaenger](https://hub.mender.io/u/msaenger)
#### Post date: [July 17, 2020, 10:46pm UTC](https://hub.mender.io/t/get-deployment-size/2206/1 "2020-07-17T22:46:55Z")

</div>

Hello!

According to the docs, the `GET /api/devices/v1/deployments/device/deployments/next` request returns the following JSON structure on success:

```
{
  "id" : "w81s4fae-7dec-11d0-a765-00a0c91e6bf6",
  "artifact" : {
    "artifact_name" : "my-app-0.1",
    "source" : {
      "uri" : "https://aws.my_update_bucket.com/image_123",
      "expire" : "2016-03-11T13:03:17.063+0000"
    },
    "device_types_compatible" : ["rspi", "rspi2", "rspi0"]
  }
}

```

Is there a way to also get the size of the deployment image? I suppose I can just use `curl` to get this information from the header, but I was just hoping there was a standard way to get it from Mender that I’m just not seeing.

---

<div class="post-metadata">

### Author: ![msaenger](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@msaenger](https://hub.mender.io/u/msaenger)
#### Post date: [July 18, 2020, 12:25am UTC](https://hub.mender.io/t/get-deployment-size/2206/2 "2020-07-18T00:25:31Z")

</div>

To add to this, I found a way to get the image size via curl, but not in a straight forward way. The following command is supposed to only get the header information from the URL without actually downloading the file but I always get back a “403 forbidden” error.

`curl -sI $URL`

If this worked I would be able to inspect the `Content-Length` and be done but it seems that the hosted Mender option doesn’t respond to header requests. Is this true or am I just doing this wrong? My workaround was to start a regular curl download but abort immediately after starting. This still retrieved the header and I was able to get the `Content-Length` without issue.

---

<div class="post-metadata">

### Author: ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)
#### Post date: [July 20, 2020, 9:52pm UTC](https://hub.mender.io/t/get-deployment-size/2206/3 "2020-07-20T21:52:39Z")

</div>

Hello!

thanks for giving Mender a try!  
I would try it in the following way (replace 127.0.0.1 with [hosted.mender.io](https://hosted.mender.io) or your hostname):

```auto
# login
jwt=`curl -k -X POST -H "Content-Type: application/json;" -u 'xxxx:xxxx' https://127.0.0.1/api/management/v1/useradm/auth/login`;

# get given deployment, in this example its id is: 9be037f4-e16d-46ef-885c-e51a5cc59664
curl -vvv -k -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $jwt" 'https://127.0.0.1/api/management/v1/deployments/deployments/9be037f4-e16d-46ef-885c-e51a5cc59664' | jq .;
{
  "name": "All devices",
  "artifact_name": "reboot-script-v1.0",
  "created": "2020-07-18T06:30:59.733Z",
  "finished": "2020-07-18T06:38:22.006Z",
  "id": "9be037f4-e16d-46ef-885c-e51a5cc59664",
  "artifacts": [
    "c839ea50-a762-4552-a2ff-0d2ef836c7e0"
  ],
  "status": "finished",
  "device_count": 1,
  "retries": 2,
  "max_devices": 1
}

# take note that the artifact was: c839ea50-a762-4552-a2ff-0d2ef836c7e0
# get the arifact size
curl -vvv -k -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $jwt" 'https://127.0.0.1/api/management/v1/deployments/artifacts/c839ea50-a762-4552-a2ff-0d2ef836c7e0' | jq .size

```

is that what you were after?

best regards,  
peter

---

<div class="post-metadata">

### Author: ![msaenger](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@msaenger](https://hub.mender.io/u/msaenger)
#### Post date: [July 21, 2020, 5:33pm UTC](https://hub.mender.io/t/get-deployment-size/2206/4 "2020-07-21T17:33:19Z")

</div>

Ah yes, thanks! I wasn’t looking at the management API so I missed this.

A question though: in what cases would you get multiple artifact IDs for a given deployment? Maybe if you were using update modules? I think in my case there should only be one so I would assume to use the zero element of the “artifacts” array.

---

<div class="post-metadata">

### Author: ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)
#### Post date: [July 22, 2020, 6:59am UTC](https://hub.mender.io/t/get-deployment-size/2206/5 "2020-07-22T06:59:56Z")

</div>

I believe you can get multiple artifacts if you have artifacts for multiple device types under the same Release name. For example two artifacts named `reboot-script-v1.0` for the device types `raspberrypi3` and `raspberrypi4`, respectively.
