dongsi1954 2011-05-03 09:04
浏览 144
已采纳

API应该负责发送邮件吗?

I am developing an API for a company. They have multiple projects lined up to interact with the API.

The API will be sent an id of an object to disable. If this is successful the user who's item was disabled should receive an email.

My question is this: should the API be responsible for sending the email or should the API return that the object was disabled and the email address to send the email to?

Many thanks, looking forward to your opinions.

  • 写回答

2条回答 默认 最新

  • douba2705 2011-05-03 09:19
    关注

    As usual, I'd say it depends. Since the requirement of sending an email is directly in scope of the API and the API doesn't do much else, I don't see why it shouldn't send it. However, I would consider certain levels of configuration.

    You could provide a function which simply returns the email address (or use a flag) and one function which does the whole thing (this should be configurable as well, e.g. set smtp server, email body text etc.). If you were to incorporate the email functionality, providing a simple function/method which only does the object manipulation comes cheap.

    NB: In any case I'd try to resolve this requirement ambiguity with the company/customer before starting to develop. It could save you development work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度