SMSAPI C# client may be used by SMSAPI.pl and SMSAPI.com clients.
varsmsApi=newSMSApi.Api.SMSFactory(client);//orvarsmsApi=newSMSApi.Api.SMSFactory(client,ProxyAddress.SmsApiIo);varsmsApi=newSMSApi.Api.SMSFactory(client,ProxyAddress.SmsApiPl);varsmsApi=newSMSApi.Api.SMSFactory(client,ProxyAddress.SmsApiCom);try{SMSApi.Api.IClientclient=newSMSApi.Api.ClientOAuth("token");varsmsApi=newSMSApi.Api.SMSFactory(client);// for SMSAPI.com clients:// var smsApi = new SMSApi.Api.SMSFactory(client, ProxyAddress.SmsApiCom);varresult=smsApi.ActionSend().SetText("test message").SetTo("0000000000").SetSender("Test")//Sender name.Execute();System.Console.WriteLine("Send: "+result.Count);string[]ids=newstring[result.Count];for(inti=0,l=0;i<result.List.Count;i++){if(!result.List[i].isError()){if(!result.List[i].isFinal()){ids[l]=result.List[i].ID;l++;}}}System.Console.WriteLine("Get:");result=smsApi.ActionGet().Ids(ids).Execute();foreach(varstatusinresult.List){System.Console.WriteLine("ID: "+status.ID+" Number: "+status.Number+" Points:"+status.Points+" Status:"+status.Status+" IDx: "+status.IDx);}}catch(SMSApi.Api.ActionExceptione){/** * Action error */System.Console.WriteLine(e.Message);}catch(SMSApi.Api.ClientExceptione){/** * Error codes (list available in smsapi docs). Example: * 101 Invalid authorization info * 102 Invalid username or password * 103 Insufficient credits on Your account * 104 No such template * 105 Wrong IP address (for IP filter turned on) * 110 Action not allowed for your account */System.Console.WriteLine(e.Message);}catch(SMSApi.Api.HostExceptione){/* * Server errors * SMSApi.Api.HostException.E_JSON_DECODE - problem with parsing data */System.Console.WriteLine(e.Message);}catch(SMSApi.Api.ProxyExceptione){// communication problem between client and severSystem.Console.WriteLine(e.Message);}- C# >= 3.5 + System.Runtime.Serialization, System.ServiceModel.Web
- C# >= 4.0