I hope someone can give me some guidance and maybe an example.
I can't seem to find a way to do this.
I need to retrieve my entire suppression list from Sparkpost using C#.
I have searched all over and all I have found is what's on the API C# reference page which is:
var client = new Client("MY_API_KEY");
client.Suppressions.List(); // returns a list of
client.Suppressions.List(new { limit = 3 }); // it accepts an anonymous type for filters
client.Suppressions.List(new SuppressionQuery()); // a SuppressionQuery is also allowed for typed help
But it gives no instructions as to how to use this. Does anyone have the code in C# to retrieve the entire suppression list?
Thanks in advance, Sam
I do not have a C# specific example but I think this should get you up and running. This is the SparkPost API you need https://developers.sparkpost.com/api/suppression-list/
If language is not super important and just looking for the easiest way to pull the list have a look here: https://www.sparkpost.com/docs/tech-resources/download-suppression-list/
... Or my pal tuck1s has this great example in Python: https://github.com/tuck1s/sparkySuppress
You will need to change $SPARKPOST_API_KEY to your API key for this.
Use this to get a summary of your suppression lists
You can do this to get your suppression list records
Here are the sources you can pull the suppressions for:
That will produce results like this
}
To get the next page of results just follow the URI sent in
/links/href
Here is a C# example as produced by PostMan for the above Curl command