# Getting name or provides from artifact before download/installation

**URL:** https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760
**Category:** General Discussions
**Created:** [March 17, 2022, 12:19pm UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760 "2022-03-17T12:19:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wouter](https://avatars.discourse-cdn.com/v4/letter/w/e99b99/32.png) [@wouter](https://hub.mender.io/u/wouter)
#### Post date: [March 17, 2022, 12:19pm UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760/1 "2022-03-17T12:19:37Z")

</div>

Hello,

For our product we use mender in both managed and standalone modes, and our users want to know before updating what version will be installed. For this we want to use the artifact name or the provides of the artifact to identify the new update.  
As far a I have seen there is no obvious way to retrieve this information without downloading and installing the update first. So my question is whether there are ways to retrieve this information?

Thanks!  
Wouter

---

<div class="post-metadata">

### Author: ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)
#### Post date: [March 22, 2022, 8:14pm UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760/2 "2022-03-22T20:14:08Z")

</div>

Hello @wouter ,

I am in a similar situation. Let me share how I managed to retrieve this information without installing the update or without downloading the the whole release.

The idea is to read the artifact and extract the `header.tar.gz` information.

With my client written in python, I first [check for the next update](https://docs.mender.io/api/#device-api-deployments-v2-check-update). If a deployment is ready, the response includes the url to dowload the artifact. (Make sure to provide the right right parameters in the request in order to receive the right response from mender).

I then query the URL using `requests` library with `stream=True` mode. I then use my request `.raw` attribute as a file object that I provide to `tarfile.open(fileobj=req.raw, mode="r|")`.

From this tar file, I `.next()` to the `header.tar.gz` file, and then I open it with `tarfile.open(mode="r|*", fileobj=f.extractfile(tarinfo)`).

I can then extract any file for `header.tar.gz` including `headers/0000/meta-data` and `headers/0000/type-info`.

I then close the connection. This way I quickly have access to supplemental information only available in the artifact **without triggering an update**. And since `header.tar.gz` is a the beginning of the tar archive. I only need to download a fraction of the deployment to get the information I need. And the update remain available when the update is triggered by the user.

The same works in standalone mode.

I tried to do the same with a bash script but did not find a way to stream only the relevant part of the archive over http to extract the header information.

Artifact encryption is yet to be implemented in my case, but I assume it should not be a problem.

I hope it helps you,

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [March 22, 2022, 8:30pm UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760/3 "2022-03-22T20:30:59Z")

</div>

Thank you for this very helpful explanation and guide @francoislefebvre!

---

<div class="post-metadata">

### Author: ![wouter](https://avatars.discourse-cdn.com/v4/letter/w/e99b99/32.png) [@wouter](https://hub.mender.io/u/wouter)
#### Post date: [March 23, 2022, 6:42am UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760/4 "2022-03-23T06:42:56Z")

</div>

Thank you very much for this answer! I will look into how we can implement this in our (c++) application

---

<div class="post-metadata">

### Author: ![ch3ckmat3](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ch3ckmat3/32/2272_2.png) [@ch3ckmat3](https://hub.mender.io/u/ch3ckmat3)
#### Post date: [November 24, 2024, 3:38pm UTC](https://hub.mender.io/t/getting-name-or-provides-from-artifact-before-download-installation/4760/5 "2024-11-24T15:38:40Z")

</div>

This is a great workaround for the problem I just posted [here](https://hub.mender.io/t/how-can-we-add-more-metadata-to-menders-check-for-deployments-response/7348).

Although Mender can provide an additional endpoint, if they don’t want to break existing API, to fetch this metadata on demand.

cc: [@Admins](https://hub.mender.io/groups/admins) @MenderDevTeam
