Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 与邮递员一起执行n次请求_Json_Postman_Postman Collection Runner - Fatal编程技术网

Json 与邮递员一起执行n次请求

Json 与邮递员一起执行n次请求,json,postman,postman-collection-runner,Json,Postman,Postman Collection Runner,我需要执行一个请求n次,在他的体内有一个id值。Collection runner允许执行n次完整的集合,但我没有找到任何具体请求 请求机构: { “idEncargo”:XXXXXXXX } 从前面的请求中,我得到了一个包含多个idEncargo的数组 有人知道这一点吗?在您的第一个请求中,如果您得到一个包含所有idEncargo的数组,则应将其保存在全局变量中 然后在第二个请求中,您将在该数组上循环 在第二个请求中,如果可能的话,或者如果希望对每个idEncargo执行http请求,可以尝试

我需要执行一个请求n次,在他的体内有一个id值。Collection runner允许执行n次完整的集合,但我没有找到任何具体请求

请求机构:

{ “idEncargo”:XXXXXXXX }

从前面的请求中,我得到了一个包含多个idEncargo的数组


有人知道这一点吗?

在您的第一个请求中,如果您得到一个包含所有idEncargo的数组,则应将其保存在全局变量中 然后在第二个请求中,您将在该数组上循环

在第二个请求中,如果可能的话,或者如果希望对每个idEncargo执行http请求,可以尝试使用setNextRequest功能(请参阅) 像这样做(对不起,我是javascript的初学者,我只是建议使用算法):

像这样的东西可能有用

希望有帮助


Alexandre

你所说的“具体”请求是什么意思?嗨,Ray,我执行了一个请求,在那里我得到了一个idEncargo列表。稍后,我需要为我在前一个请求中获得的每个idEncargo执行另一个请求。测试方案为:1请求ListaEncargo->列出IdEncargo(idEncargo1,idEncargo2,…,idEncargoN)2。-请求加密(idEncargo1)3。-请求Encargo(idEncargo2)。。。N+1请求加密(idEncargoN)
request 1 - get my idEncargo array and set it in global // to bypass if array exists
        set global my_index = 0
        setNextRequest("request 2")
request 2 on idEncargo[my_index]
        in request 2 tests part do:
        my_index ++
        if my_index == max value
            setNextRequest("null") // breaks the loop
        else
            setNextRequest("request 2") // processes the next idEncargo