OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Postman - collect variable [duplicate]

  • Thread starter Thread starter Jedas
  • Start date Start date
J

Jedas

Guest
I'm new to Postman and using APIs but.. I've made a POST API call to get data:

Code:
[
    {
        "oha_c_2": "da7274da-2c3e-4197-994d-b3bcf89f73f0"
    }
]

I'm trying to save variable so I could use it in my next API call but it keeps saying variable is undefined. This is the post-res script I use:

Code:
const response = pm.response.json();
console.log(response.oha_c_2);
pm.collectionVariables.set('reference', response.oha_c_2)

I'm sure it's an easy fix for someone with some experience, any help is appreciated!

<p>I'm new to Postman and using APIs but.. I've made a POST API call to get data:</p>
<pre><code>[
{
"oha_c_2": "da7274da-2c3e-4197-994d-b3bcf89f73f0"
}
]
</code></pre>
<p>I'm trying to save variable so I could use it in my next API call but it keeps saying variable is undefined.
This is the post-res script I use:</p>
<pre><code>const response = pm.response.json();
console.log(response.oha_c_2);
pm.collectionVariables.set('reference', response.oha_c_2)
</code></pre>
<p>I'm sure it's an easy fix for someone with some experience, any help is appreciated!</p>
 

Latest posts

Top