ServiceDesk Plus on deman REST API with VB.Net
I'm trying to develop a small web application with VB .net ASP.
I got authkey from
link. But GetResponse always returns error 400 bad request.
Can somebody suggest what's wrong with my code? strID is request ID.
- Dim sData As String
- Dim request As WebRequest = WebRequest.Create("http://sdpondemand.manageengine.com/api/json/request/" & strID)
- Dim myProxy As New WebProxy("xxxxxxx", 8080)
- myProxy.BypassProxyOnLocal = True
- request.Proxy = myProxy
- request.Method = "POST"
- request.ContentType = "application/x-www-form-urlencoded"
- sData = "scope=sdpodapi"
- sData = sData & "&authtoken=" & AuthKey
- sData = sData & "&OPERATION_NAME=GET_REQUEST"
- Dim encoding As New System.Text.UTF8Encoding()
- Dim bytes As Byte() = encoding.GetBytes(sData)
- request.ContentLength = bytes.Length
- Try
- Dim requestStream As Stream = request.GetRequestStream()
- requestStream.Write(bytes, 0, bytes.Length)
- requestStream.Close()
- requestStream.Dispose()
- Dim res As WebResponse = request.GetResponse()
- Dim resStream As Stream = res.GetResponseStream()
- Dim sr As New StreamReader(resStream, encoding)
- Get_Request = sr.ReadToEnd()
- Catch ex As Exception
- Get_Request = ex.Message.ToString
- End Try
New to ADSelfService Plus?