Hello everyone,
I need your help please.
I would like to retrieve a value from the json. a variable.
how can i get it back please? I tried the command in the .js
const newman = require(‘newman’),
fs = require(‘fs’);
const request= Math.random().toString(36).substring(7) + ‘-request.txt’;
newman.run({
collection: require(‘./G-test1.postman_collection.json’),
iterationData: ‘./data.csv’,
environment : require(‘./Recette Externe Copy.postman_environment.json’),
reporters: ‘cli’,
iterationCount : 1
}).on(‘request’, function (error, args) {
if (error) {
console.error(error);
}
else {
fs.appendFile(request, args.item.request.auth.basic[1].key , function (error) {
if (error) {
console.error(error);
}
});
}
});
my json
},
"request": {
"auth": {
"type": "basic",
"basic": [
{ "key": "password",
"value": "{{MDP}}",
"type": "string"
},
{ "key": "username",
"value": "{{NOM_OP}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "OP",
"value": "{{NOM_OP}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{ \r\n \"
Thankyou