| POST | /qbowebhook |
|---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
import com.google.gson.annotations.*;
import com.google.gson.reflect.*;
public class dtos
{
@DataContract
public static class QboWebhooksRequest
{
@DataMember(Name="eventNotifications")
@SerializedName("eventNotifications")
public ArrayList<QBOEventNotification> EventNotifications = null;
public ArrayList<QBOEventNotification> getEventNotifications() { return EventNotifications; }
public QboWebhooksRequest setEventNotifications(ArrayList<QBOEventNotification> value) { this.EventNotifications = value; return this; }
}
public static class QBOEventNotification
{
@DataMember(Name="realmId")
@SerializedName("realmId")
public String RealmId = null;
@DataMember(Name="dataChangeEvent")
@SerializedName("dataChangeEvent")
public QBODataChangeEvent DataChangeEvent = null;
public String getRealmId() { return RealmId; }
public QBOEventNotification setRealmId(String value) { this.RealmId = value; return this; }
public QBODataChangeEvent getDataChangeEvent() { return DataChangeEvent; }
public QBOEventNotification setDataChangeEvent(QBODataChangeEvent value) { this.DataChangeEvent = value; return this; }
}
public static class QBODataChangeEvent
{
@DataMember(Name="entities")
@SerializedName("entities")
public ArrayList<QBOEntity> Entities = null;
public ArrayList<QBOEntity> getEntities() { return Entities; }
public QBODataChangeEvent setEntities(ArrayList<QBOEntity> value) { this.Entities = value; return this; }
}
public static class QBOEntity
{
@DataMember(Name="name")
@SerializedName("name")
public QBOEntityName Name = null;
@DataMember(Name="id")
@SerializedName("id")
public String Id = null;
@DataMember(Name="operation")
@SerializedName("operation")
public QBOOperation Operation = null;
@DataMember(Name="lastUpdated")
@SerializedName("lastUpdated")
public Date LastUpdated = null;
@DataMember(Name="deletedId")
@SerializedName("deletedId")
public String DeletedId = null;
public QBOEntityName getName() { return Name; }
public QBOEntity setName(QBOEntityName value) { this.Name = value; return this; }
public String getId() { return Id; }
public QBOEntity setId(String value) { this.Id = value; return this; }
public QBOOperation getOperation() { return Operation; }
public QBOEntity setOperation(QBOOperation value) { this.Operation = value; return this; }
public Date getLastUpdated() { return LastUpdated; }
public QBOEntity setLastUpdated(Date value) { this.LastUpdated = value; return this; }
public String getDeletedId() { return DeletedId; }
public QBOEntity setDeletedId(String value) { this.DeletedId = value; return this; }
}
public static enum QBOEntityName
{
Customer(20),
Department(21),
Vendor(21),
Deposit(22),
Invoice(23),
Bill(24),
Item(24),
JournalCode(25),
PurchaseOrder(25),
JournalEntry(26),
Estimate(26),
RefundReceipt(26),
Employee(27),
SalesReceipt(27),
TaxAgency(28),
Term(29),
TimeActivity(30),
Account(30),
Transfer(31),
VendorCredit(31),
CreditMemo(32),
Purchase(33),
Currency(33),
Payment(35),
PaymentMethod(36),
BillPayment(36),
Preferences(37),
Budget(37),
Class(38);
private final int value;
QBOEntityName(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static enum QBOOperation
{
Update,
Create,
Merge,
Delete,
Emailed,
Void;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<QboWebhooksRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ESI.Service.QBOWebhooksListener">
<eventNotifications>
<QBOEventNotification>
<DataChangeEvent>
<Entities>
<QBOEntity>
<DeletedId>String</DeletedId>
<Id>String</Id>
<LastUpdated>0001-01-01T00:00:00</LastUpdated>
<Name>Customer</Name>
<Operation>Update</Operation>
</QBOEntity>
</Entities>
</DataChangeEvent>
<RealmId>String</RealmId>
</QBOEventNotification>
</eventNotifications>
</QboWebhooksRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length (string)