// destination modes:
/*
RandomDestination = 1,
SequentialDestination = 3,
SequenetialGlobal = 8,
Weighted = 9
*/
//create datapoint links rotator(sequential)
var model = {
Id: 0,
Name: "test123",
Title: "Rotator test",
GroupId: [groupId],
DatapointType: 0,
TypeTL: {
RedirectType: 307,
DomainId: [domainId],
DestinationMode: "8",
SequentialDestinationItems: [
{
Url: "http://www.clickmeter.com"
},
{
Url: "http://my.clickmeter.com"
}
]
},
Tags: []
};
$.ajax({
type: "POST",
url: 'http://apiv2.clickmeter.com/datapoints/',
dataType: 'json',
data: JSON.stringify(model),
headers: { "X-Clickmeter-AuthKey": 'API-KEY', "Content-type": "application/json" }
})
.successs(function (data) {
// data: { id: 123, uri: '/datapoints/123' }
})
.error(function (jqXhr, textStatus, errorThrown) {
//jqXhr.responseText - { errors: {errorMessage: 'some message', errorValue: 'property name'}}
});
0 Comments