作为Java中实现的Webhook的mandrill反弹信息

时间:2018-12-13 18:38:06

标签: java mandrill

尽管Mandrill / Mailchimp付了钱,但我似乎没有得到他们的支持!我试图弄清楚如何在Java中实现Webhook以获取电子邮件退回信息。 我在这里https://mandrillapp.com/api/docs/webhooks.JSON.html

查看了文档

到目前为止,我已添加

@ApiOperation(
            value = "Mandrill webhook",
            notes = "Mandrill webhook",
            response = BaseResponse.class
    )
    @Path("/webhook")
    @POST
    public BaseResponse webhook(@ApiParam(value = "user request", required = true) WebhookEvent webhookEvent) {

        log.info("received mandrill request");
        log.info("event: " + webhookEvent);
        return new BaseResponse();
    }

public class WebhookEvent implements Serializable {

    @JsonProperty(value = "event")
    String event;

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    @Override
    public String toString() {
        return "WebhookEvent{" +
                "event='" + event + '\'' +
                '}';
    }
}

但是我在日志中看到:

ERROR  [20:24:47.197] [dw-34 - POST /mandrill/webhook] c.f.SlackExceptionMapper -  runtime error occurred
javax.ws.rs.NotSupportedException: HTTP 415 Unsupported Media Type
    at org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.getMethodRouter(MethodSelectingRouter.java:478)

任何帮助将不胜感激!

0 个答案:

没有答案