How can i send a string array via HTTP POST using WebClient.UploadValues method?
Question
I need to use HTTP Post to send a a string array like so...
Dim wc As New Net.WebClient
Dim NC As New Specialized.NameValueCollection
NC.Add("api_user", "some user")
NC.Add("api_key", "some key")
NC.Add("from", "me@world.com")
NC.Add("subject", "testing...")
NC.Add("body", "testing...again")
NC.Add("to", string_array)
i have tried several methods, but i keep getting - The remote server returned an error: (400) Bad Request.
I'm posting to SendGrid via their WebAPI
Solution
Just found a solution.
For i = 0 To addresess.Length - 1
NC.Add("to[" & i & "]", addresess(i))
Next
use an index and the same keyName
Help came from here : POST'ing arrays in WebClient (C#/.net)
OTHER TIPS
If you are receiving a 404, then that most likely means that either the URL in your application for their service is incorrect or the service is not currently running. Can you copy the URL that is in your application and paste it into a browser address area to see if you can access it directly?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow