// destination modes:
/*
Simple = 0,
DynamicUrl = 4,
BrowserDestination = 5,
NationDestination = 6,
*/
//create datapoint tracking link
var model = {
Name: 'short_link_name',
Title: 'some title',
Tags: [{ name: 'tagname' }],
GroupId: groupId,
EncodeIp: false,
DatapointType: 0,
TypeTL: {
DomainId: [domainid],
DestinationMode: 0,
RedirectType: 307,
Url: 'http://www.yourdestinationurl.com'
}
};
$.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