To install EzTexting API client, run the following command in the Package Manager Console
PM> Install-Package EzTextingApiClientor using nuget console tool:
$ nuget install EzTextingApiClientit will install the latest public version, other releases you can find at releases page. After these steps EzTextingApiClient should appear in your project dependencies along with other transitive ones.
-
Note for Visual Studio installation: to be able to use api client please manually copy EzTextingApiClient.dll.config from your solutionFolder\packages\EzTextingApiClient.?.?.? folder to target dir. You can use post-build event for that (https://msdn.microsoft.com/en-us/library/ke5z92ks.aspx). Command example for post-build event:
xcopy "$(SolutionDir)packages\EzTextingApiClient.?.?.?\lib\EzTextingApiClient.dll.config" "$(TargetDir)" /i /R /Y
In case you want to build it yourself:
$ git clone https://github.com/CallFire/eztexting-api-client-csharp.git
$ cd eztexting-api-client-csharp
// build on windows platform
$ gradlew.bat clean nugetPack
// build on unix platforms
$ ./gradlew clean nugetPackit will produce zip & Nuget packages in build/pkg directory:
EzTextingApiClient.dll - client assembly
EzTextingApiClient.dll.config - configuration file
EzTextingApiClient.xml - XML documentationthen you can install Nuget package locally or unpack zip package into your project’s lib directory.
To create client instance just provide your account’s login and password. Client uses HTTPS connection. By default it connects to EzTexting site, but you can specify any other related brand: ClubTexting, GroupTexting, TellMyCell, etc.
Example how to get your account’s credit balance:
class MainClass
{
public static void Main(string[] args)
{
EzTextingClient client = new EzTextingClient("user", "pass");
Console.WriteLine("account balance: " + client.CreditsApi.CheckBalance());
}
} EzTextingClient client = new EzTextingClient("login", "password");
client.ContactsApi; - add/get/update/delete contacts
client.CreditsApi; - check balance, buy credits
client.GroupsApi; - managing contact groups
client.InboxApi; - managing your inbox messages and folders
client.KeywordsApi; - check availability, rent a keyword
client.MediaLibraryApi; - managing Media Library files
client.MessagingApi; - send SMS/MMS/Voice broadcast messages
client.ToolboxApi; - different helpful APIs, currently it only has a Carrier Lookup operation.The EzTexting Developers API uses standard HTTP response codes for responses. These HTTP codes indicate whether or not an API operation is successful.
Status Code 200 is the desired response code. A standard JSON response will follow.
Codes in the 400s range detail all of the errors a EzTexting Developer could encounter while using the API. Bad Request, Rate Limit Reached, and Unauthorized are some of the sorts of responses in the 400s block.
Codes in the 500s range are error responses from the EzTexting system. If an error has occurred anywhere in the execution of a resource that was not due to user input, a 500 response will be returned with a corresponding JSON error body. In that body will contain a message detailing what went wrong.
-
EzTextingClientException - in case error has occurred in client
-
EzTextingApiException - in case API cannot be queried for some reason and server returned error
EzTextingApiException has errors property with details why errors has occurred.
Configuration:
RestApiClient.getClientConfig().Add(ClientConstants.PROXY_ADDRESS_PROPERTY, "localhost:3128");
RestApiClient.getClientConfig().Add(ClientConstants.PROXY_CREDENTIALS_PROPERTY, "proxyuser:proxypass");
// now create client
EzTextingClient client = new EzTextingClient("user", "pass");
Console.WriteLine("account balance: " + client.CreditsApi.CheckBalance());IMPORTANT. You must add proxy address property and proxy credentials (if needed) before client instantiation!
Proxy address port is optional, 8080 is used by default.
In case you want to see requests/responses which client sends/receives from EzTexting platform you should copy system.diagnostics section from EzTextingApiClient.dll.config into your application’s app.config file, then it will create eztexting-api-client.log file in your work directory with debug output.
Source code debugging is available with a help of nuget symbolsource directory. Recommended configuration for Visual Studio: http://www.symbolsource.org/Public/Home/VisualStudio
Library was built and tested on OS X with mono 4.2.1 .NET 4.5 and Windows 7 x64 .NET 4.5 platform
In case you have an issue, please create a ticket at Issues page. Issue description should contain a brief info (including versions) about platform, IDE, .NET framework where this SDK is used.
-
EzTextingApiClient.dll.config file is placed next to .dll assembly
-
System.Configuration is selected in project’s references window