MoveCreditsToClient
Move message credits from a master account to a client account
// uses JQuery libraryvar postUrl = 'https://secure.smsgateway.ca/services/account.svc/' + masterAccountKey + '/MoveCreditsToClient/' + clientAccountKey;
var body = JSON.stringify({ NumberOfCredits: numberOfCredits,});
$.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); });<?php// using SOAP Module - http://ca3.php.net/soap
class SMSParam { public $MasterAccountKey; public $ClientAccountKey; public $NumberOfCredits;}
$client = new SoapClient('https://secure.smsgateway.ca/sendsms.asmx?WSDL');$parameters = new SMSParam;
$parameters -> MasterAccountKey = masterAccountKey;$parameters -> ClientAccountKey = clientAccountKey;$parameters -> NumberOfCredits = numberOfCredits;
$Result = $client->MoveCreditsToClient($parameters);?>' Service Reference (SOAP)Using client = New SwiftSMS.SendSMSSoapClient Dim response = client.MoveCreditsToClient(masterAccountKey, clientAccountKey, numberOfCredits)End Using
' WebClient (REST)Dim url = String.Format("https://secure.smsgateway.ca/services/account.svc/{0}/MoveCreditsToClient/{1}", masterAccountKey, clientAccountKey)Dim body = String.Format("{{ ""NumberOfCredits"": {0} }}", numberOfCredits)
Using wClient = New Net.WebClient wClient.Encoding = New UTF8Encoding() wClient.Headers.Add(HttpRequestHeader.ContentType, "application/json")
Dim wResponse = wClient.UploadString(url, body)End Usingcurl -H "Content-Type: application/json" -X POST \ "https://secure.smsgateway.ca/services/account.svc/[masterAccountKey]/MoveCreditsToClient/[clientAccountKey]" \ --data "{\"NumberOfCredits\": 10 }// Service Reference / SOAPusing (var client = new SwiftSecure.SendSMSSoapClient()){ var creditsMoved = client.MoveCreditsToClient(masterAccountKey, clientAccountKey, numberOfCredits);}
dynamic body = new ExpandoObject();body.NumberOfCredits = 10;
var url = string.Format("https://secure.smsgateway.ca/services/account.svc/{0}/MoveCreditsToClient/{1}", masterAccountKey, clientAccountKey);
using (var wClient = new System.Net.WebClient()){ wClient.Encoding = Encoding.UTF8; wClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
var creditsMoved = wClient.UploadString(url, Newtonsoft.Json.JsonConvert.SerializeObject(body));}HTTP Request
POST:
/services/account.svc/:masterAccountKey/MoveCreditsToClient/:clientAccountKey| Parameter | Description | Location |
|---|---|---|
| masterAccountKey | Your Parent Swift SMS Gateway account key (Credits moved FROM this account) | URL |
| clientAccountKey | Your Child Swift SMS Gateway account key (Credits moved TO this account) | URL |
| NumberOfCredits | The number of credits to move from the MASTER to the CLIENT account | BODY |
Returns
integer – The number of credits moved to the client account. Zero if
there was an issue moving credits.