Sample code for 30+ languages & platforms
VB.NET

Send a Form-URL-Encoded REST Request

See more REST Examples

Demonstrates Rest.FullRequestFormUrlEncoded, which sends an application/x-www-form-urlencoded request. The body is built from the query parameters added to the object, and the response body is returned as text.

Background. For a form-url-encoded request the accumulated parameters become the request body rather than the URL query string. This matches the encoding used by HTML form POSTs.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim rest As New Chilkat.Rest
Dim bTls As Boolean = True
Dim bAutoReconnect As Boolean = True
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = False) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


'  The application/x-www-form-urlencoded body is built from the query parameters added to the object.
rest.AddQueryParam("username","alice")
rest.AddQueryParam("action","login")

'  Send the form-url-encoded request.  The parameters become the request body rather than the URL
'  query string.
Dim responseText As String = rest.FullRequestFormUrlEncoded("POST","/api/login")
If (rest.LastMethodSuccess = False) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If

Debug.WriteLine(responseText)