Setting variables in node from response/globals/environment variables

Hi,

I’m using newman as a node module and I’m trying to either set a global/environment variable as a js variable or access & parse the response and set it as a variable that way - I can’t find anything in the reference material that explains how to do this. I did find exportGlobals: require(‘xxx.json’); - but this doesn’t seem to actually update the specified json file at all (the variable in question has no value set).

My actual use case is:
I get sent a collection name as part of a request to my node server, I send the collection name to the ‘Single Collection’ postman API: https://www.getpostman.com/collections/8a54de8f97aab0f5722c
This returns the UID which I then use to run the collection in question. The variable I’m trying to set is the UID - either by setting it as a global/environment variable then exporting and parsing the file, or by directly parsing the response.

Does anyone know a way to do this?

I am having a hard time understanding exactly what you are trying to do.

Have you tried setting the variable in your Tests like pm.globals.set(uuid, response.something);

Hi vdespa,

I’m trying to assign variables in node (when running my ‘index.js’ file) from the responses I get during a collection run.

EDIT: I’ve worked out what I was looking for: summary.response.json() - that gives me the response body as json.