Data Driven : How to attach single json file to Postman collection runner having multiple APIs (requests) in it?

I am trying to automate the testing of different APIs. I have created collection in postman. There are multiple APIs present inside a collection and each API has different body structure (inputs) and different test cases. Each API should be tested for multiple testcases. e.g. API 1 has 2 Test cases and API 2 has 5.


    input a
    input b
    input c
    input d


    input 1
    input 2
    input 3
    input 4
    input 5

I want to send body of each API dynamically through JSON file.

I need a single JSON file which can contain data for all APIs.

is it possible? If yes, How can achieve it?

Yes. You can structure your json data file as below and then use the input in the API you want.

“input a”:“val”,
“input b”:“val”,
“input 1”:“val”,
“input 2”:“val”

Hi @vjjohnson04,

I tried your solution but It will be messy for more number of APIs.
Also for iteration 3, API 1 will not have any input so it will get failed.

Let me reform my query with more specific example.

I have 2 APIs named “LogIn” API and “search” API.

Request body for “LogIn” API is as follows,

     "userName": "{{username}}",
     "passWord": "{{password}}"

I have created JSON file for “LogIn” API, which looks like,


Request body for “Search” API is as follows,


There is an another JSON file for “Search” API is as follows

I want to run login API for two iterations(refer JSON for login) and search API for 5 iterations(refer JSON for search).

I want to automate testing of these two APIs using single JSON file (combination of these two files). Please suggest how should I achieve it?
Both the APIs are currently in same collection runner.

The way I would do this is by adding a Test Control file which would contain the below code.

var userName = pm.iterationData.get(“userName”);
var passWord = pm.iterationData.get(“passWord”);

if(userName !=="" && passWord !==""){
} else {


Hope this helps.