# Fetch both the application environment variables and device environment variables in the same api call

**URL:** <https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936>\
**Category:** Product support\
**Created:** [May 10, 2017, 11:21am UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936 "2017-05-10T11:21:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishant](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nishant](https://forums.balena.io/u/nishant)\
**Post date:** [May 10, 2017, 11:21am UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936/1 "2017-05-10T11:21:30Z")

</div>

Looking at the documentation, we could not find any api calls that has both the app level and device level environment variables in the same response. Looking further in the requests, we found an api call, that fetches both  
`curl "https://api.resin.io/environment?appId=<appId>&deviceId=<deviceId>" -H "Content-Type: application/json" -H "Authorization: Bearer <api-key>"`

Again, this isn’t also present in the node resin-sdk documentation. We are building a node app and it’d really help if we have a same api call to fetch both variables like the above curl request. Please let us know on the node api for the same or if there are any alternatives, we could also use that.

---

<div class="post-metadata">

**Author:** ![charlietango592](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@charlietango592](https://forums.balena.io/u/charlietango592)\
**Post date:** [May 10, 2017, 11:27am UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936/2 "2017-05-10T11:27:46Z")

</div>

Good point! It would be really nice and **handy** to have a flag (I named it applicationVariables) in `resin.models.environmentVariables.device.getAll(deviceUuid, applicationVariables)` which tells the API to include or not the application’s variables 🙂

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 10, 2017, 1:46pm UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936/3 "2017-05-10T13:46:51Z")

</div>

Thanks for the feedback! 🎉 We’ve taken a note and think it over what’s the best approach to cover this.

---

<div class="post-metadata">

**Author:** ![pimterry](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pimterry/32/140_2.png) [@pimterry](https://forums.balena.io/u/pimterry)\
**Post date:** [May 10, 2017, 8:34pm UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936/4 "2017-05-10T20:34:42Z")

</div>

Thanks for the feedback! This is a great idea, I’ve filed an issue on the SDK to take a look at it: [https://github.com/resin-io/resin-sdk/issues/322](https://github.com/resin-io/resin-sdk/issues/322). You can subscribe to the issue directly there if you’d like updates.

---

<div class="post-metadata">

**Author:** ![charlietango592](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@charlietango592](https://forums.balena.io/u/charlietango592)\
**Post date:** [May 11, 2017, 4:01pm UTC](https://forums.balena.io/t/fetch-both-the-application-environment-variables-and-device-environment-variables-in-the-same-api-call/936/5 "2017-05-11T16:01:13Z")

</div>

Thanks very much for being responsive! Keeping an eye on the issue
