CPU.Notifications

<back to all web services

SendGridEvents

Requires Authentication
The following routes are available for this service:
POST/sendgridevents
import Foundation
import ServiceStack

public class SendGridEvents : List<SendGridEvent>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class SendGridEvent : Codable
{
    // @DataMember(Name="sg_event_id")
    public var sg_event_id:String

    // @DataMember(Name="sg_message_id")
    public var sg_message_id:String

    public var email:String
    public var timestamp:Int
    // @DataMember(Name="smtp-id")
    public var smtp_id:String

    public var event:String
    public var type:String
    public var category:[String]
    public var reason:String
    public var status:String
    public var userAgent:String
    public var ip:String
    public var url:String
    // @DataMember(Name="url_offset")
    public var url_offset:String

    // @DataMember(Name="sg_machine_open")
    public var sg_machine_open:Bool

    public var tls:String
    // @DataMember(Name="unique_args")
    public var unique_args:[String:String]

    // @DataMember(Name="custom_args")
    public var custom_args:[String:String]

    // @DataMember(Name="marketing_campaign_id")
    public var marketing_campaign_id:String

    // @DataMember(Name="marketing_campaign_name")
    public var marketing_campaign_name:String

    // @DataMember(Name="singlesend_id")
    public var singlesend_id:String

    // @DataMember(Name="singlesend_name")
    public var singlesend_name:String

    // @DataMember(Name="bounce_classification")
    public var bounce_classification:String

    required public init(){}
}


Swift SendGridEvents DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /sendgridevents HTTP/1.1 
Host: cpmwebservices-t.clarkpud.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

[]
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

(string)