发布仅将电子邮件发送到第一个收件人地址的json正文

时间:2019-12-15 09:49:14

标签: json linux curl

我有文件body.json文件-

{"recipientAddress":"abc@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}}
{"recipientAddress":"xyz@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}}
{"recipientAddress":"def@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}}

现在,当我跑步时-

curl -X POST "https://api.com/messaging/message/email"-H "Content-Type: application/json" -d @body.json

仅发送并通过电子邮件发送到第一个电子邮件地址,即abc@gmail.com

有人可以帮助我,因为电子邮件会触发所有3个收件人地址吗?

谢谢

1 个答案:

答案 0 :(得分:0)

结合以上评论,请尝试以下操作并重新提交:

[
    {"recipientAddress":"abc@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}},

    {"recipientAddress":"xyz@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}},

    {"recipientAddress":"def@gmail.com","staticMessage":{"senderAddress":"noreply@mail.co.uk","subject":"Report","body":"Unique Users LoggedIn on 14/12/2019 - 7"}}
];

也值得一提的是,这也取决于您使用的特定API。因此,您应该尝试的第一件事是查阅API文档。 POST请求并不是硬性规定,因此就我们所知,这意味着“一次给我们一个项目”。