Env.get and env.set

I’m trying to initiate a request to the notecard by setting an environment variable to 1 on notehub.io and retrieving it periodically on the card side using env.get.

After doing what needs to be done on the card side, I would like to reset the variable to 0, but seems to me that env.set does not override any notehub value.

Should I be doing this in a different way?

Hi @paulohm!

I’m not sure what you’re trying to accomplish, but you could use an inbound Note. It’s sychronized between the Notehub and Notecard, queued, and delivered to the host. Then you can delete it, which would restore the system to it’s original state.

If you want a state that is shared between the Notecard and Notehub, then you can use a .db file. There is a nice example on the API reference page.

If this isn’t what you’re thinking, perhaps you can provide a bit more color to the problem, so I can better understand what exactly you are trying to accomplish.

Happy hacking,
Zak

3 Likes

Thanks for the reply. I’m building an user front-end so he can request some notecard actions.

One way that I thought of accomplishing this would be set environment variables by using the environment API (Environment Variable API - Notehub API Reference - Blues Developers) and making the notecard respont to variable changes.

1 Like

I have the same issue with @paulohm, I cant seem to override environmental variables via the API, is there a reason why?

Hi @Pius4109,

Make sure you’re trying to override an environment variable that was set at or below the current hierarchical level (i.e. env vars set on the Notecard with env.set can’t be overridden with an API call…but project-level variables can be overridden at the fleet or device level). Check out this doc:

Rob

1 Like