API v1 Post Inputs for GetSpamChecks
Problem reported by Jeff Mayfield - 7/23/2020 at 11:00 AM
Just upgraded to v17 build 7503 (Jul 17, 2020) and am trying to update some internal software from the Legacy API to the new REST style API. I have gotten through the authentication and made several calls to functions that don't require Post Inputs without issue. My problem is understanding the Post Inputs such as in the GetSpamChecks method.

Where do I find out what those fields are and their valid values?

4 Replies

Reply to Thread
echoDreamz Replied
Same, the new API is bit... confusing. The older API is much easier to use and just a better experience overall.
Matt Petty Replied
Employee Post Marked As Resolution
A good way to see how an API is used is to look at the web interface and using chrome debugger tools to see the calls.

I was able to get spamchecks with this POST below, note that the "translations" is required, this probably shouldn't be the case.
POST URL: https://mail.smartertools.com/api/v1/settings/sysadmin/antispam/spam-checks
POST DATA, Content-type: application/json

{"searchParams":{"skip":0,"take":"10000","search":null,"sortField":"name","sortDescending":false},"translations":[{"key":"CYREN","translation":"Cyren Premium Antispam"},{"key":"DECLUDE","translation":"Declude"},{"key":"DKIM","translation":"DKIM"},{"key":"DOMAINKEYS","translation":"Domain Keys"},{"key":"MESSAGESNIFFER","translation":"Message Sniffer"},{"key":"REMOTESPAMASSASSIN","translation":"Remote SpamAssassin"},{"key":"SPAMASSASSIN","translation":"SpamAssassin-Based Pattern Matching"},{"key":"REVERSEDNS","translation":"Reverse DNS"},{"key":"NULLSENDER","translation":"Null Sender"},{"key":"SPF","translation":"SPF"},{"key":"HONEYPOT","translation":"Honey Pot"}]}

So for example, I opened my chrome debugger window. Navigated to the spam checks section, then I was able to see how the interface made that call. If you replicate what the interface does best you can, you should get the same results out of it.
Matt Petty
Software Developer
SmarterTools Inc.
(877) 357-6278
Jeff Mayfield Replied
Thank you for your response.  I am not good enough with the Chrome debugger to find this (I tried) but what you posted gave me what I needed.  Hopefully their will be a thorough update to the API docs.

Side note - their is nothing in the spam check section of the message header to document that forward/reverse DNS checks were done.  7503 is my first install since v16 which had it.
echoDreamz Replied
It would be great if SM supported Swagger or if you guys did some pre-built some libraries for .net, php etc.

Reply to Thread