I am using someone's API to get data.
The Api accepts a parameter and some headers.
Now in Postman I created a GET link and it fired perfectly.
In VB.NET I tried following code but I get error json response notifying that parameter missing.
Following is my VB.NET code
Public Function MIGetGSTin(ByVal URL As String, ByVal accesstoken As String, ByVal clientID As String) Dim Requester As HttpWebRequest = HttpWebRequest.Create(URL) Requester.Method = "GET" Requester.Timeout = -1 Requester.ContentType = "application/json" 'Requester.Headers.Add("Authorization", "Bearer " & accesstoken) 'Requester.Headers.Add("client-id", clientID) Requester.Headers("Authorization") = "Bearer " & accesstoken Requester.Headers("client-id") = clientID Dim ResponseStreamReader As New StreamReader(Requester.GetResponse().GetResponseStream()) Return ResponseStreamReader.ReadToEnd() End Function I also tried like during vb.net code execution I fetched the data, copied it and pasted in postman and it works there.
For a reference I post a pic of the manual to run the url which I was given by the API providers.
NOTE : Below image is just for reference. All credential data inside it is altered.
Also posting my postman setting
NOTE : POSTMAN RESPONSE IS VALID. THIS POSTMAN SETTING IS WORKING. POSTMAN IS JUST FOR REFERENCE
I Don't know where I am wrong.
PLEASE NOTE IF ANYTHING IS NEEDED.
THANK YOU
UPDATE : Also tried according to @Jimi said in the comments but not working. FOLLOWING is the new code below
Public Function MIGetGSTin(ByVal URL As String, ByVal accesstoken As String, ByVal clientID As String) Dim Requester As HttpWebRequest = WebRequest.CreateHttp(URL) Requester.Method = "GET" Requester.Timeout = -1 Requester.ContentType = "application/json" Requester.Headers.Add(HttpRequestHeader.Authorization, $"Bearer {accesstoken}") Requester.Headers.Add("client-id", clientID) Requester.Headers.Add(HttpRequestHeader.CacheControl, "no-cache") 'Requester.Headers.Add("Authorization", "Bearer " & accesstoken) 'Requester.Headers("Authorization") = "Bearer " & accesstoken 'Requester.Headers("client-id") = clientID Using ResponseStreamReader As New StreamReader(Requester.GetResponse().GetResponseStream()) Return ResponseStreamReader.ReadToEnd() End Using 'Dim ResponseStreamReader As New StreamReader(Requester.GetResponse().GetResponseStream()) End Function 

?gstin=[some value]query tuple? The correct form is[HttpWebRequest].Headers.Add(HttpRequestHeader.Authorization, $"Bearer {accesstoken}"), the same for the other header. AddRequester.Headers.Add(HttpRequestHeader.CacheControl, "no-cache")Also change the WebRequest initialization inDim Requester = WebRequest.CreateHttp(URL)Dim ResponseStreamReader As New StreamReader(Requester.GetResponse().GetResponseStream()): both the HttpWebResponse and the Stream must be declared withUsingstatements?gstin=[some value]is single value and not a tuple or multiple values combined. (Searched query tuple on internet. rectify me if I am wrong.) For Ex.?gstin=24AAHDDA1231Jthats it.{"error":true,"message":"paramter missing"}. I wrote code according to what you said. Also Updating question again. Please check it.