v3主体中发送动态变量

v3主体中发送动态变量

本文介绍了使用邮递员在sendgrid v3主体中发送动态变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用邮递员使用v3 API通过Sendgrid发送电子邮件,我在3个不同的请求中创建了3个单独的变量,我想在一封邮件中传递所有这3个变量,为此我在sendgrid $下使用了b $ b 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": "[email protected]",
          "name": "API Testing"
        }
      ],
      "subject": "API testing successful"
    }
  ],
  "from": {
    "email": "[email protected]",
    "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}} ,您有多个搜索查询,(狗,国际象棋,奇迹,stackoverflow)

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


  • 在邮递员中创建收藏集

  • https://google.com/q添加GET请求= {{search}} 包含必要的标题,然后点击 Save

  • 使用标题创建CSV文件搜索及其下的所有搜索值

  • 为新创建的集合点击运行按钮

  • 迭代次数字段设置为您拥有的查询数。在此示例中为4

  • 查找字段 Data ,选择创建的CSV文件

  • 点击 Preview 按钮

  • 命中运行测试,确保可以正确提取数据
  • code>
  • 您可以在邮递员控制台

  • 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 Console或使用键盘快捷键(CMD / CTRL + ALT + C)打开。

这篇关于使用邮递员在sendgrid v3主体中发送动态变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 22:29