Skip to content

GetCreditsUsedInDateRange

Get a count of message credits used by an account between the given dates

// uses JQuery library
var postUrl =
'https://secure.smsgateway.ca/services/account.svc/' +
accountKey +
'/CreditsUsedInDateRange';
var todayDate = new Date();
var weekAgo = new Date();
weekAgo.setTime(todayDate.getTime() - 7 * 24 * 3600000); // 7 days * 24 hours * 3600000 milliseconds
var body = JSON.stringify({
DateFrom: todayDate.getTime(),
DateTo: weekAgo.getTime(),
});
$.ajax({
url: postUrl,
method: 'POST',
contentType: 'application/json;charset=UTF-8',
data: body,
})
.done(function (response) {
alert(response);
})
.error(function (xhr, textStatus, errorThrown) {
alert(xhr.responseText);
});

HTTP Request

GET:

/services/account.svc/:accountKey/CreditsUsedInDateRange
ParameterDescriptionLocation
AccountKeyYour Swift SMS Gateway account keyURL
DateFromStart date for credit usage reportBODY
DateToEnd date for credit usage reportBODY

Returns

integer