| POST | /qbowebhook |
|---|
import Foundation
import ServiceStack
// @DataContract
public class QboWebhooksRequest : Codable
{
// @DataMember(Name="eventNotifications")
public var eventNotifications:[QBOEventNotification]
required public init(){}
}
public class QBOEventNotification : Codable
{
// @DataMember(Name="realmId")
public var realmId:String
// @DataMember(Name="dataChangeEvent")
public var dataChangeEvent:QBODataChangeEvent
required public init(){}
}
public class QBODataChangeEvent : Codable
{
// @DataMember(Name="entities")
public var entities:[QBOEntity]
required public init(){}
}
public class QBOEntity : Codable
{
// @DataMember(Name="name")
public var name:QBOEntityName
// @DataMember(Name="id")
public var id:String
// @DataMember(Name="operation")
public var operation:QBOOperation
// @DataMember(Name="lastUpdated")
public var lastUpdated:Date
// @DataMember(Name="deletedId")
public var deletedId:String
required public init(){}
}
public enum QBOEntityName : Int, Codable
{
case Customer = 20
case Department = 21
case Vendor = 21
case Deposit = 22
case Invoice = 23
case Bill = 24
case Item = 24
case JournalCode = 25
case PurchaseOrder = 25
case JournalEntry = 26
case Estimate = 26
case RefundReceipt = 26
case Employee = 27
case SalesReceipt = 27
case TaxAgency = 28
case Term = 29
case TimeActivity = 30
case Account = 30
case Transfer = 31
case VendorCredit = 31
case CreditMemo = 32
case Purchase = 33
case Currency = 33
case Payment = 35
case PaymentMethod = 36
case BillPayment = 36
case Preferences = 37
case Budget = 37
case Class = 38
}
public enum QBOOperation : String, Codable
{
case Update
case Create
case Merge
case Delete
case Emailed
case Void
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /qbowebhook HTTP/1.1
Host: wh.entersecurity.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
eventNotifications:
[
{
realmId: String,
dataChangeEvent:
{
entities:
[
{
name: Customer,
id: String,
operation: Update,
lastUpdated: 0001-01-01,
deletedId: String
}
]
}
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length (string)