URLConnection.SetRequestContent

From Xojo Documentation

Method

URLConnection.SetRequestContent(content As String, mimeType As String)

Supported for all project types and targets.

Sets the content data and content type to be sent to the server.

Sample Code

Sends a POST request with JSON:

Var json As New JSONItem
json.Value("ID") = 123456

mySocket.SetRequestContent(json.ToString, "application/json")
mySocket.Send("POST", "http://127.0.0.1:8080/GetCustomer")

To send form information, you build the String yourself:

// Build form String
Var formText As String = "firstName=Bob&lastName=Roberts"

// POST it
mySocket.SetRequestContent(formText, "application/x-www-form-urlencoded")
mySocket.Send("POST", "http://www.webserviceurl.com")