使用邮递员在 sendgrid v3 正文中发送动态变量邮递员、文中、变量、动态

2023-09-07 11:20:13 作者:兔儿神你真的火了!

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

I am trying to send the emails via Sendgrid using v3 API using postman, I have created 3 separate variables in 3 different requests, I want to pass all those 3 variables in a single mail, for that I have used below sendgrid https://api.sendgrid.com/v3/mail/send with below body

{
  "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}},有人可以帮我解决这个问题吗?

but the above format sending the mail body as {{Variable1}}, can someone help me on this?

推荐答案

据我了解,您想发送多个不同值的请求.

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

说,GET 到 https://google.com/q={{search}} 并且您有多个搜索查询(dog、chess、marvel、stackoverflow)

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

在邮递员中创建一个集合向 https://google.com/q={{search}} 添加一个带有必要标头的 GET 请求,然后点击 Save创建一个带有标题 search 及其下所有搜索值的 CSV 文件点击新创建集合的运行按钮将 Iterations 字段设置为您拥有的查询数.在本例中为 4查找字段Data,选择创建的CSV文件点击Preview按钮确保数据被正确提取点击运行测试您可以在Postman Console中查看输出 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 控制台在应用程序菜单中前往查看,然后点击显示 Postman 控制台"或使用键盘快捷键(CMD/CTRL + ALT + C)打开.

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.