Hebben jullie een voorbeeldcode voor de API?

Private Sub Online()

Dim webRequest As HttpWebRequest
Dim webResponse As HttpWebResponse
Dim ioReader As StreamReader
Dim xmlResponse As XmlDocument
Dim strResults As String
Dim strLink As String
Try
strLink = “https://accept.mailinglijst.nl/api/?key=[key]&action=[action]”

webRequest = DirectCast(System.Net.WebRequest.Create(strLink), HttpWebRequest)
webResponse = DirectCast(webRequest.GetResponse(), HttpWebResponse)
ioReader = New StreamReader(webResponse.GetResponseStream())
strResults = ioReader.ReadToEnd()

Me.litResult.Text = strResults

‘Do something with response from API

Catch ex As Exception
‘Catch exception
End Try
End Sub

Private Sub PostBody()
Dim strUrl As String
Dim webResp As HttpWebResponse
Dim webReq As HttpWebRequest
Dim ioWriter As StreamWriter
Dim ioReader As StreamReader
Dim strResponse As String
Try
strUrl = “https://accept.mailinglijst.nl/api/?key=[key]&action=BODYPOST&s=[onderwerpregel]&n=[naam]&d=[omschrijving]&o=[eigenaar]”

webReq = WebRequest.Create(strUrl)
webReq.Method = “POST”
webReq.ContentType = “text/html;charset=””iso-8859-15″””
webReq.Accept = “text/html”

ioWriter = New StreamWriter(webReq.GetRequestStream())
ioWriter.Write(txtBody.Text)
ioWriter.Close()

webResp = webReq.GetResponse()

ioReader = New StreamReader(webResp.GetResponseStream())
strResponse = ioReader.ReadToEnd()

‘ Do something with response from API

Catch ex As Exception
‘ Catch exception
End Try

End Sub

Gaf dit artikel antwoord op je vraag? Bedankt voor de feedback! Het is niet gelukt, probeer het later nog een keer

Nog steeds hulp nodig? Neem contact op Neem contact op