简体   繁体   English

如何设置 jmeter 以使用不记名令牌、api 密钥和其他参数发出 POST 请求?

[英]How do I setup jmeter to make POST request with bearer token, api key and other parameters?

Can someone please show me how to make POST request in jmeter if I have a bearer token, x-api key, api url, and json body in this format: Can someone please show me how to make POST request in jmeter if I have a bearer token, x-api key, api url, and json body in this format:

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {
      "fullUrl": "08b4-4ee4-b51b-803e20ae8126",
      "resource": {
        "resourceType": "Player",
        "name": [
          {
            "family": "Jameson",
            "given": [
              "Matt"
            ]
          }
        ],
        "gender": "male"
      },
      "request": {
        "method": "POST",
        "url": "Player"
      }
    },
    {
      "resource": {
        "resourceType": "Player",
        "name": [
          {
            "family": "Smith",
            "given": [
              "John"
            ]
          }
        ],
        "gender": "male"
      },
      "request": {
        "method": "POST",
        "url": "Player"
      }
    }
  ]
}

Also how do I setup parameters as shown in image: Image below shows how I set it up in postman, all parameters https://ibb.co/C8dwQ2m另外我如何设置参数,如图所示:下图显示了我如何在 postman 中设置它,所有参数https://ibb.co/C8dwQ2m

  1. Add HTTP Request sampler to your Test Plan and put the URL and the JSON payload thereHTTP 请求采样器添加到您的测试计划中,并将 URL 和 JSON 有效负载放在那里

    在此处输入图像描述

  2. All the values which are at your screenshot stand for HTTP Headers so add a HTTP Header Manager and specify the values there:屏幕截图中的所有值都代表HTTP 标头,因此添加HTTP Header 管理器并在那里指定值:

    在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM