//Javascript Code Sample

//UserRegister

var userInfoModel = {
    ApplicationId = "9a680ce6-a627-4b93-8a86-d4d27495705a",
    NameSurname = "Name and surname of user",
    Phone = "+905555555555",
    Email = "abc@xyz.com",
    WebAuth = "1",
    Password = "abcxyz",
    DeviceID = "123456",
    DeviceToken = "65665665464564165513213",
    DeviceType = "IPHONE",
    IpAddress = "78.125.89.45",
    Country = "Turkey",
    ExternalUserID = "external ID of user",
    AuthEmail = "1",
    AuthPush = "1",
    AuthSms = "1"
};

var obj = { userinfo: userInfoModel };

$.ajax({
    type: "POST",
    url: "https://buffer.blipnow.com/BufferService.svc/UserRegister",
    data: JSON.stringify(obj),
    success: success,
    dataType: dataType
});

//DeviceRegister

var userInfoModel = {
    ApplicationId = "9a680ce6-a627-4b93-8a86-d4d27495705a",
    Phone = "+905555555555",
    Email = "abc@xyz.com",
    DeviceID = "123456",
    DeviceToken = "65665665464564165513213",
    IpAddress = "78.125.89.45",
    Country = "Turkey",
    ExternalUserID = "external ID of user"
};

var obj = { userinfo: userInfoModel };

$.ajax({
    type: "POST",
    url: "https://buffer.blipnow.com/BufferService.svc/DeviceRegister",
    data: JSON.stringify(obj),
    success: success,
    dataType: dataType
});


//SendNotification

var devices = [];
devices.push({ DeviceID = "123456" });
devices.push({ Email = "abc@xyz.com" });
devices.push({ UserID = "ID of user" });

var pushNotificationModel = {
    ApplicationId = "9a680ce6-a627-4b93-8a86-d4d27495705a",
    Message = "Notification Title",
    MessageTitle = "Notification Body",
    MessageType = "Text",
    Devices = devices
};

var pushNotifications = [];
pushNotifications.push(pushNotificationModel);
var obj = { pushNotifications: pushNotificationModel };

$.ajax({
    type: "POST",
    url: "https://buffer.blipnow.com/BufferService.svc/SendNotification",
    data: JSON.stringify(obj),
    success: success,
    dataType: dataType
});