【问题标题】:Replacing Parameters in REST Requests in Postman from JSON/YAML files从 JSON/YAML 文件替换 Postman 中 REST 请求中的参数
【发布时间】:2017-06-20 09:02:37
【问题描述】:

我当前的问题是:我需要能够执行以下调用: https://{Net-IP}:{Net-Port}/rest/devices/{deviceName}.{deviceID}

首先定义一个宿主变量,例如: 主持人:{Net-IP}:{Net-Port} 是不可能的。

其次,如果我尝试在路径中实现路径参数,例如: /devices/{deviceName}.{deviceID}/measurePoints: get: summary: Method returns list of measure points parameters: - name: deviceName in: path type: string required: true description: device Name - name: deviceID in: path type: string required: true description: device ID

然后它说路径模板是不允许的。

我需要为 Postman 翻译这类电话,感谢您的帮助!

【问题讨论】:

    标签: javascript json rest yaml postman


    【解决方案1】:

    【讨论】:

    • 好的,我知道了如何制作它:我只需在请求中获取一个路径变量(您只能在“/”之后包含一个),然后我只需将这个变量映射到两个环境变量上像这样的预请求脚本:postman.setEnvironmentVariable("pathVariable", environment["environmentVariable1" ]+environment["environmentVariable2"]);
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    • 1970-01-01
    • 2019-12-11
    • 2014-01-24
    • 1970-01-01
    • 2023-03-29
    • 2016-12-17
    相关资源
    最近更新 更多