request error with variable in POSTMAN

Hello,

I try POSTMAN to use BINANCE API.

When i use an environnement variable in a request for “quantity” parameter, i have a code error : -1022.

POSTMAN genere the following code :
fetch(“https://testnet.binancefuture.com/fapi/v1/order?symbol=BTCUSDT&side=BUY&type=MARKET&quantity=15.8270&timestamp=1606488994076&signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”, requestOptions)

  • .then(response => response.text())*
  • .then(result => console.log(result))*
  • .catch(error => console.log(‘error’, error));*

You cannot directly quote environment var in parameters; If you really have to use env var, please process it in pre-request script;
Meanwhile fetch() doesn’t work for creating orders

Thank you.

The variable “quantity” is created in pre-post.
postman.setEnvironmentVariable (“quantity”, quantity);

however the variables “signature” and “timestam” are created in pre-post as well.

I use postman in order to do automatic hourly variable request.
I’m new to APIs and programming.

Please check the pre-request script, timestamp and signature are both processed specially;
You need to add something like below:

parameters.map((param) => {
if (
param.key != ‘quantity’ &&
param.key != ‘signature’ &&
param.key != ‘timestamp’ &&
!is_empty(param.value) &&
!is_disabled(param.disabled)) {
paramsObject[param.key] = param.value;
}
})

Object.assign(paramsObject, {‘quantity’: <your quantity var>}); // Need to make sure the order in the url and here in the object are consistent
Object.assign(paramsObject, {‘timestamp’: ts});

perfect thank you

Good friend,

I have tried to do the same as your request but it does not work for me.

My intention in trying to change the quantity in the pre-request script

The quantity is updated in the url of post but I have the same error.

How could I fix it?

Thanks

Replied in Set quantity (USDT) when create a post new order into pair BTCUSDT