I tried this, but I keep getting an error that it’s an invalid URL.
If I hardcode it, it works, but not using the {{enviroment variable}} syntax.
const newman = require('newman');
newman.run(
{
collection: 'https://api.getpostman.com/collections/6267034-a257e524-c6f8-487b-8185-
fb633e60781a?apikey={{postman_api_key}}',// <-----Doesn't work
environment: require('.\\Innovations odc Lab01.postman_environment.json'),
reporters: 'htmlextra',
reporter:
{
htmlextra:
{
export: '.\\Results.html',
template: '.\\template.hbs',
title: 'Innovations API',
showEnviornmentData: true,
showMarkdownLinks: true,
showFolderDescription: true
}
}
}, function (err) {
if (err) { throw err; }
console.log('collection run complete!');
});
Error: collection could not be loaded
** Error fetching the collection from the provided URL. Ensure that the URL is valid.**
** Invalid API Key. Every request requires a valid API Key to be sent.**
The postman_api_key is in the enviornment.json.
Also, is there some documentation that covers this?
The only newman docs I found are on their Github page and it’s not all that great.