When try to use a UrlConnection I only get access denied:
Dim FormData As New JSONItem
FormData.Value("api_key") = "65oh666xxx"
FormData.Value("sender_name") = "Beatrix Willius from Moth Software"
FormData.Value("sender_email") = "mail@beatrixwillius.de"
FormData.Value("subject") = "test subject"
FormData.Value("body") = "<html><body>test body</body></html>"
FormData.Value("list_id") = "1"
theSocket.SetRequestContent(FormData.ToString, "application/json")
dim theResult as String = theSocket.SendSync("POST", "https://api.selzy.com/en/api/createEmailMessage")
dim ResultDictionary as Dictionary = ParseJSON(theResult)
if ResultDictionary.HasKey("error") then
MessageBox("There was an error when trying to create an email: " + EndOfLine + EndOfLine + ResultDictionary.Value("error"))
Return
end if
Also, it looks like Selzy is for sending email campaigns, as in sending one or more emails to a group of people.
Is that really what you need @Beatrix_Willius ?
If you are looking for transactional emails (as in sending a different email to each person) it looks like you will need to use https://unione.io which is owned or a partner of Selzy.
@Jeremie_L : Selzy also allows POST data which is I’m trying to get working. GET works fine. I’m trying to send bulk emails to a list. I want to get rid of MailChimp where I still use RSS to email.
@Ivan_Tellez : No, I’m not sure if this is needed here.
Dim FormData as MultipartFormDataContent = new MultipartFormDataContent()
FormData.Add("api_key", "65oh666cxxx")
FormData.Add("sender_name", "Beatrix Willius from Moth Software")
FormData.Add("sender_email", "mail@beatrixwillius.de")
FormData.Add("subject", "test subject")
FormData.Add("body", "<html><body>test body</body></html>")
FormData.Add("list_id", "1")
FormData.Add("format", "json")
FormData.SetURLConnectionMultipartContent(theSocket)
Dim result as String = theSocket.SendSync("POST", "https://api.selzy.com/en/api/createEmailMessage")
Can you show the raw request Postman sends? I know Paw/RapidAPI can show that, it would be helpful and could illustrate the difference in requests. You’re welcome to send it privately if necessary.
All parameters should be encoded in UTF-8. In the example above the parameters are given in the GET request, but you can send them through POST as well. Moreover, we strongly recommend that you send the api_key parameter through POST to ensure it’s not saved in proxy servers logs.
POST https://api.selzy.com/en/api/createEmailMessage?api_key=65oh666xxx&sender_name=Beatrix%20Willius%20from%20Moth%20Software&sender_email=mail@beatrixwillius.de&subject=test%20subject&body=%3Chtml%3E%3Cbody%3Etest%20body%3C/body%3E%3C/html%3E&list_id=1&format=json
The list of parameters for the method called is transferred in params . Parameters can be transferred either via a GET request or via POST. You are strongly recommended to use only POST requests, since the data transferred in them is not stored in logs of the servers engaged in the connection. This increases the security of your work through API.
So you could use “x-www-form_urlencoded” (or even “mutlipart/form-data”)
Something like:
var params As string = "param1=value1¶m2=value2¶m3=value3"
// you may be required to EncodeURLComponent all of the values.
mySocket.SetRequestContent(params, "x-www-form_urlencoded")
mySocket.Send("POST", "https://api.selzy.com/en/api/createEmailMessage")