Note that there are some explanatory texts on larger screens.

plurals
  1. POSend HTTP Request, parameter confusion
    primarykey
    data
    text
    <p>I'm trying to send a HTTP request to a servers interface. But I'm really confused about how to specify the parameters I want to send to the servers interface method. What I've done so far.</p> <p>My server interface only accepts POST requests, that's why I'm using POST and asked if something is wrong with the way I use the parameters.</p> <pre><code>Dim parameters As String = "?text=test&amp;type=person" Dim buffer As Byte() = Encoding.UTF8.GetBytes(parameters) Dim WebReq As HttpWebRequest = CType(WebRequest.Create(NameRecPage), HttpWebRequest) 'NameRecPage is the url WebReq.Credentials = New NetworkCredential(Username, Password) 'variables are defined and theier values are valid WebReq.Method = "POST" WebReq.ContentType = "application/x-www-form-urlencoded" WebReq.ContentLength = buffer.Length Dim PostData As Stream = WebReq.GetRequestStream() PostData.Write(buffer, 0, buffer.Length) PostData.Close() Dim WebResp As HttpWebResponse = DirectCast(WebReq.GetResponse(), HttpWebResponse) Dim Answer As Stream = WebResp.GetResponseStream() Dim _Answer As New StreamReader(Answer) Dim inputBuffer As String = _Answer.ReadToEnd() </code></pre> <p>That's my code so far and it's sending a request. But i get an error saying that the first (and i think also the second) parameter is null. </p> <p>I'm quite unsure about these two line:</p> <pre><code>Dim parameters As String = "?text=test&amp;type=person" WebReq.ContentType = "application/x-www-form-urlencoded" </code></pre> <p>Is there something wrong with my parameter syntax?</p> <p>Are these spellings correct in my content? What is content type about? What does it say and how do I determine which value to put in there?</p> <p>I don't know if thats the correct value for ContentType, actually I just want to receive some JSON fromatted data returned as string.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload