Professional Documents
Culture Documents
URL: https://<server>/getbalance?account=***&password=***
URL:
https://<server>/sendsms?account=***&password=***&sender=***&numbers=***&content=**
*
URL: https://<server>/getreport?account=***&password=***&ids=1234567
URL: https://<server>/getsms?account=***&password=***
JSON RESPON: {"status":0,"cnt":2,"array":[[1,”
628xxx”,”123456”,20171001123015,"********************************"],[2,”
628xxx”,”123456”,20171001123015,"********************************"]]}
Push sample:
{"type":"report","cnt":2,"array":[[1,"6281210100055",20180801123015,0,"success"],[2
,"6281908080709",20180801223015, 1, "no balance"]]}
1. Get Balance
HTTP get is supported to obtain the balance of the corresponding account in the system.
Data of query(The body segment of the HTTP message)is a JSON array composed by one or more task. Parameter Content-Type in
HTTP head should set to “application/json;charset=utf-8”.
Method of calling:
https://<server>/getbalance?account=***&password=***
Input parameter:
parameter description required data type
version Protocol version number N(default 1.0) String
account account Y String
password password Y String
Output parameter:
parameter description data type
status query status INT
0:query success
-1:authentication error
-2:IP limited access
balance The balance of the actual account String
gift Complimentary account balance String
Reply sample:
{“status”:0, "balance":"99.990000", "gift":"50.00000"}
2. Send SMS
Support HTTP get or post for sending SMS messages, get sends up to 100 Numbers at a time, and post can submit up to
10,000 Numbers at once.
Submitted results data (The body segment of the HTTP message)is a JSON array composed by one or more task. Parameter
Content-Type in HTTP head should set to “application/json;charset=utf-8”.
Method of calling:
https://<server>/sendsms?account=***&password=***&numbers=628xxx,628xxx&sender=**
*&content=***
Output parameter:
parameter description data type
status Send submission status INT
0:Query success
-1:Authentication error
-2:IP limited access
-3:SMS contain sensitive characters
-4:SMS contain is empty
-5:SMS contain is too long
-6:Not a template SMS
-7:Over number
-8:Number is empty
-9:Abnormal number
-10:The channel balance is insufficient to satisfy this
transmission
Note: after the submission of the SMS, the system will generate an Id for the successful number. After that, the customer can query the
sending result of the message according to this Id.
Reply sample:
{"status":0, "success":2, "fail":0, "array":[[628xxx,1], [628xxx,2]]}
3. Get Report
HTTP get is supported to query the SMS sending status, and get sends up to 200 Numbers at once.
Get report data (The body segment of the HTTP message)is a JSON array composed by one or more task. Parameter Content-
Type in HTTP head should set to “application/json;charset=utf-8”.
Method of calling:
https://<server>/getreport?account=***&password=***&ids=1234567,2233445
Input parameter:
Output parameter:
parameter description data type
status Send submission status INT
0:Query success
Note: after the submission of the text message, the system will generate an Id for the successful number. After that, the customer can
query the sending result of the message according to this Id.
Reply sample:
{"status":0, "success":1, "fail":1, "unsent":0, "sending":0, "nofound":0,
"array":[[1, 628xxx,20171001123015,0], [2, 628xxx,20171001123015,3]]}
Note: above-mentioned array [1,10010,20171001123015,0],each field corresponds to the status query ID, number, sending time
and status of the number.
Input parameter:
parameter description required data type
version Protocol version number N(default 1.0) String
account account Y String
password password Y String
start_time Timestamp of start the query N INT
Output parameter:
parameter description data type
status Query request status INT
0:Query success
-1:Authentication error
-2:IP limited access
-3:SMS contain sensitive characters
-4:SMS contain is empty
-5:SMS contain is too long
-6:Not a template SMS
-7:Over number
-8:Number is empty
-9:Abnormal number
-10:The channel balance is insufficient to satisfy this
transmission
-11:The timing is wrong
-12:Because of the platform, batch commit error, please
contact the administrator
-13: User locked
cnt receive SMS number of Query (a get request is not more INT
than 50)
array An array of successful SMS
The array contains "id(the unique id in the system),
sending number, sending time, message content",
Reply sample:
{"status":0,"cnt":2,"array":[[1,”
628xxx”,”123456”,20171001123015,"********************************"],[2,”
628xxx”,”123456”,20171001123015,"********************************"]]}
The url of the push report of the consumer can be configured on the system. After the system sends the SMS, the result of the SMS will
be pushed to the url specified by the customer in the way of put. The content of the report will be placed in the body of the request in the
format of json.Push up to 50 send reports at a time.
Push sample:
{"type":"report","cnt":2,"array":[[1,"6281210100055",20180801123015,0,"success"],[2
,"6281908080709",20180801223015, 1, "no balance"]]}
PHP
<?php
if ($response) {
print_r($response);
}
curl_close($ch);
}
?>
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
<!doctype html>
<html lang=”en”>
<head>
<metacharset=”utf-8″>
<title>TCASTSMS</title>
<scriptsrc=”https://code.jquery.com/jquery-1.10.2.js”></script>
</head>
<body>
<div id=”response”></div>
<script>
(function() {
var username =”xxxxx”;
var password =”xxxxx”;
var destination =”628xxxxx”;
var content =”Test Script TCASTSMS JavaScript klik www.tcastsms.co.id”;
var baseUri =”http://<server>/sendsms?”;
var tcastUri = baseUri +
“account=”+ username
+”&password=”+ password
+”&numbers=”+ destination
+”&content=”+encodeURIComponent(content);
$.getJSON( tcastUri)
.done(function( data ) {
document.getElementById(“response”).value= data;
});
})();
</script>
</body>
</html>
//Rextester.Program.Main is the entry point for your code. Don’t change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace Rextester
{
publicclassDataObject
{
publicstringName { get; set; }
}
publicclassProgram
{
privateconststringURL=”http://<server>/sendsms”;
//private static string urlParameters =
System.Web.HttpUtility.UrlEncode(“account=xxxxx&password=xxxxx&numbers=628xxxxx&content=Test
-Content-SMS”);
publicstaticvoidMain(string[] args)
{
varaccount=”xxxxx”;
varpassword=”xxxxx”;
vardest=”628xxxxx”;
varcontentMsg=System.Web.HttpUtility.UrlPathEncode(“Test Script TCASTSMS .NET klik
www.tcastsms.co.id”);
varfinalUrlParam=”?account=”+account
+”&password=”+password
+”&numbers=”+dest
+”&content=”+contentMsg;
HttpClientclient=newHttpClient();
client.BaseAddress=newUri(URL);
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(
newMediaTypeWithQualityHeaderValue(“application/json”));
// Console.WriteLine(“urlParameters {0}”, finalUrlParam);
// List data response.
HttpResponseMessageresponse=client.GetAsync(finalUrlParam).Result; // Blocking call! Program
will wait here until a response is received or a timeout occurs.
if (response.IsSuccessStatusCode)
{
stringres=””;
TCASTSMS® - PT AGARA CIPTA MANDIRI 12 | P a g e
ADDRESS: JEPE 9 Building - Jalan Raya Ragunan No.9 Jati Padang, Pasar Minggu Jakarta Selatan 12540 – Indonesia
PHONE: +62. 21 7815328; +62. 21 7823311 EMAIL: marketing@tcastsms.co.id WEB: www.tcastsms.co.id
using (HttpContentcontent=response.Content)
{
// … Read the string.
Task<string> result=content.ReadAsStringAsync();
res=result.Result;
Console.WriteLine(“{0}”, res);
}
}
else
{
Console.WriteLine(“{0} ({1})”, (int)response.StatusCode, response.ReasonPhrase);
}
//Make any other calls using HttpClient here.
//Dispose once all HttpClient calls are complete. This is not necessary if the containing
object will be disposed of; for example in this case the HttpClient instance will be
disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
}
}