diff --git a/docs/examples_credits.md b/docs/examples_credits.md index 94f26f6..5cdff58 100644 --- a/docs/examples_credits.md +++ b/docs/examples_credits.md @@ -4,7 +4,7 @@ ``` - curl -s http://api.sparrowsms.com/v2/credit \ + curl -s http://api.sparrowsms.com/v2/credit/ \ -F token='' \ ``` @@ -15,7 +15,7 @@ ``` - $api_url = "http://api.sparrowsms.com/v2/credit". + $api_url = "http://api.sparrowsms.com/v2/credit/?". http_build_query(array( 'token' => '', @@ -33,7 +33,7 @@ import requests r = requests.get( - "http://api.sparrowsms.com/v2/credit", + "http://api.sparrowsms.com/v2/credit/", params={'token' : ''}) status_code = r.status_code @@ -41,4 +41,37 @@ response_json = r.json() +``` + +------- + +## C\# (C-sharp) + +``` + + using System.Collections.Specialized; + using System.IO; + using System.Net; + using System.Text; + + namespace SparrowSMSTest{ + + class Program{ + static void Main(string[] args) + { + var getResponseTest = GetCredits(''); + } + + private static string GetCredits(string token) + { + using (var client = new WebClient()) + { + string parameters = "?"; + parameters += "token=" + token; + var responseString = client.DownloadString("http://api.sparrowsms.com/v2/credit/" + parameters); + return responseString; + } + } + } + ``` \ No newline at end of file diff --git a/docs/examples_outgoing.md b/docs/examples_outgoing.md index 422bada..96625f4 100644 --- a/docs/examples_outgoing.md +++ b/docs/examples_outgoing.md @@ -4,7 +4,7 @@ ``` - curl -s http://api.sparrowsms.com/v2/sms \ + curl -s http://api.sparrowsms.com/v2/sms/ \ -F token='' \ -F from='' \ -F to='' \ @@ -20,7 +20,7 @@ ``` - $api_url = "http://api.sparrowsms.com/v2/sms?". + $api_url = "http://api.sparrowsms.com/v2/sms/?". http_build_query(array( 'token' => '', 'from' => '', @@ -42,7 +42,7 @@ 'to' => '', 'text' => 'SMS Message to be sent')); - $url = "http://api.sparrowsms.com/v2/sms"; + $url = "http://api.sparrowsms.com/v2/sms/"; # Make the call using API. $ch = curl_init(); @@ -70,7 +70,7 @@ import requests r = requests.get( - "http://api.sparrowsms.com/v2/sms", + "http://api.sparrowsms.com/v2/sms/", params={'token' : '', 'from' : '', 'to' : '', @@ -90,7 +90,7 @@ import requests r = requests.post( - "http://api.sparrowsms.com/v2/sms", + "http://api.sparrowsms.com/v2/sms/", data={'token' : '', 'from' : '', 'to' : '', @@ -100,4 +100,74 @@ response = r.text response_json = r.json() +``` + +------- + +## C\# (C-sharp) + +**GET Method: ** + +``` + + using System.Collections.Specialized; + using System.IO; + using System.Net; + using System.Text; + + namespace SparrowSMSTest{ + + class Program{ + static void Main(string[] args) + { + var getResponseTest = GetSendSMS('', '', '', 'SMS Message to be sent'); + } + + private static string GetSendSMS(string from, string token, string to, string text) + { + using (var client = new WebClient()) + { + string parameters = "?"; + parameters += "from=" + from; + parameters += "&to=" + to; + parameters += "&text=" + text; + parameters += "&token=" + token; + var responseString = client.DownloadString("http://api.sparrowsms.com/v2/sms/" + parameters); + return responseString; + } + } + } + +``` + + +**POST Method: ** + +``` + + using System.Collections.Specialized; + using System.Net; + using System.Text; + + namespace SparrowSMSTest{ + class Program{ + static void Main(string[] args){ + var responseTest = PostSendSMS('', '', '', 'SMS Message to be sent'); + } + + private static string PostSendSMS(string from, string token, string to, string text){ + using (var client = new WebClient()){ + var values = new NameValueCollection(); + values["from"] = from; + values["token"] = token; + values["to"] = to; + values["text"] = text; + var response = client.UploadValues("http://api.sparrowsms.com/v2/sms/", "Post", values); + var responseString = Encoding.Default.GetString(response); + return responseString; + } + } + } + } + ``` \ No newline at end of file diff --git a/docs/outgoing_credits.md b/docs/outgoing_credits.md index 632b0ef..f62bd7e 100644 --- a/docs/outgoing_credits.md +++ b/docs/outgoing_credits.md @@ -11,7 +11,7 @@ It can be used to know about the available credits, consumed credits. ## Method ``` - /credit + /credit/ ``` ## Parameters diff --git a/docs/outgoing_sendsms.md b/docs/outgoing_sendsms.md index 65b7282..6daa5fa 100644 --- a/docs/outgoing_sendsms.md +++ b/docs/outgoing_sendsms.md @@ -12,7 +12,7 @@ ## Method ``` - /sms + /sms/ ``` ## Parameters