1

我正在尝试使用邮递员使用 v3 API 通过 Sendgrid 发送电子邮件,我在 3 个不同的请求中创建了 3 个单独的变量,我想在一封邮件中传递所有这 3 个变量,因为我在 sendgrid 下面使用 https://api.sendgrid.com/v3/mail/send
了下面的正文

{
  "personalizations": [
    {
      "to": [
        {
          "email": "testing@test.com",
          "name": "API Testing"
        }
      ],
      "subject": "API testing successful"
    }
  ],
  "from": {
    "email": "noreply@testApi.com",
    "name": "API Testing"
  },
  "content": [
    {
      "type": "text/plain",
      "value": "{{variable1}}"  //In variable1 has a dynamic values
    }
  ]
}

但是上述格式将邮件正文发送为 {{Variable1}},有人可以帮我吗?

4

1 回答 1

0

From what I understand of the question you want to send multiple requests with different values.

Say, GET to https://google.com/q={{search}} and you have multiple search queries, (dog, chess, marvel, stackoverflow)

  • Create a collection in postman
  • Add a GET request to https://google.com/q={{search}} with necessary headers and hit Save
  • Create a CSV file with the header search and all search values under it
  • Hit the run button for the newly created collection
  • Set the Iterations field to the number of queries you have. In this example it is 4
  • Look for the field Data, select the created CSV file
  • Ensure the data is correctly being picked up by hitting the Preview button
  • Hit Run test
  • You can view the output in the Postman Console

postman runner

To open Postman Console Head to View in the application menu, and click on "Show Postman Console" or use the keyboard shortcut (CMD/CTRL + ALT + C) to open.

于 2019-12-23T14:53:29.740 回答