Skip to content
Sailthru .NET client
C#
Branch: master
Clone or download
Latest commit a038927 Aug 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sailthru [COM-5805] rename method Jun 25, 2019
.gitignore nuget-upload: support building nuget packages Aug 22, 2017
.travis.yml CI: set solution name Aug 2, 2019
MIT-LICENSE.txt update docs May 5, 2016
README.md nuget-upload: update doc link Aug 23, 2017

README.md

sailthru-net-client

For installation instructions, documentation, and examples please visit: https://getstarted.sailthru.com/developers/api-client/net/

A simple client library to remotely access the Sailthru REST API as per http://getstarted.sailthru.com/developers/api

As of commit b8714e2, UserRequest.OptoutEmail is now an enum rather than a string. Replace "all" with "OptoutStatus.All", "blast" with "OptoutStatus.Blast", "basic" with "OptoutStatus.Basic", and "none" with "OptoutStatus.None". For example, "userRequest.OptoutEmail = "all";" should now be "userRequest.OptoutEmail = OptoutStatus.All;"

API Rate Limiting

Here is an example how to check rate limiting and throttle API calls based on that. For more information about Rate Limiting, see Sailthru Documentation

SailthruClient sailthruClient = new SailthruClient(apiKey, apiSec);

// ... make some api calls ....

Hashtable lastRateLimitInfo = sailthruClient.getLastRateLimitInfo("user", "post");

// getLastRateLimitInfo returns null if given endpoint/method wasn't triggered previously
if (lastRateLimitInfo != null) {
	int limit = lastRateLimitInfo['limit'];
	int remaining = lastRateLimitInfo['remaining'];
	DateTime reset = (DateTime)lastRateLimitInfo['reset'];

    // throttle api calls based on last rate limit info
    if (remaining <= 0) {
        TimeSpan time_span_till_reset = reset.Subtract(DateTime.now());
        // sleep or perform other business logic before next user api call
        Thread.Sleep(time_span_till_reset);
    }
}
You can’t perform that action at this time.