binance / binance-api-postman

Postman collection for Binance Public API, including spot, margin, futures, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postman not setting BInance environment variables

djp9192 opened this issue · comments

Hi, i've used Postman for Binance for some time successfully, but not for a while ... and now all requests which require an API key fail:
"code": -2008,
"msg": "Invalid Api-Key ID."
In the code say for {{url}}/sapi/v1/capital/config/getall?timestamp={{timestamp}}&signature={{signature}} the environment variable is not being set properly::
myHeaders.append("X-MBX-APIKEY", "api-key");
And when i hover on the environment variable in the Header section of the API call, you can see that the current value is not set.

But in the Environment, the variable binance-api-key has the correct initial value and current value set.

p.s. i've reinstalled POSTMAN for Desktop, and i've deleted and reimported the Binance SPOT collection and the Environment.

Any ideas?

From the Postman UI, navigate to Environment and make sure that the Initial Value and Current Value are set with your API Key correctly. Try to create a new API Key if it fails again.

Yes, as mentioned, in the Environment, the variable binance-api-key has the correct initial value and current value set.

I did try many different sets of API keys, before i realized that that wasn't helping, since the API parms and header weren't using the refreshed environment variable values.

postmanlabs/postman-app-support#6001 (comment)

There is an issue thread for this on postman. Try and see if this fixes your problem.

Thanks, but it doesn't help. I've tried all the suggestions already, I've signed out & in, uninstalled and reinstalled postman, deleted and reimported the collection and environment, and the bug is still there.

Go to the postman menu:
View -> Show Postman Console
Then you will see the raw logs of each request. You should be able to see what exactly API key was sent in the request header.

Yes, thanks i've checked that before. From the console it also shows that no value is being set for X-MBX-APIKEY (from the environment variable which does have a correct value):
Request Headers
Content-Type: application/json
X-MBX-APIKEY: api-key

image

Please check the environment file and also the header in each request. Make sure you have the SAME settings as in the screenshot.

The header setting comes from the post collection. Maybe it worths to download the collection and import it again.

Yes thanks, the header is exactly as per the screen shot, and the environment variable is set for that variable.
header

But when you hover you see the header variable doesn't contain the expected value.

I've deleted and reimported the collection and environment several times, and reinstalled postman, but same problem ever time.

that's weird. Maybe you can try setup the environment file again?
Or maybe reinstall the postman. Not sure why the binance-api-key is not set.

Please open new issue if you still has any difficult.