Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Main()
- client = New DataExtractor("https://pagename.com/web/service", "MyUsername", "MyPassword")
- Try
- token = client.getToken
- Catch ex As Exception
- End Try
- End Main
- Public Class DataExtractor
- Private _baseURI As String
- Private _passWord As String
- Private _userName As String
- Sub New(ByVal baseUri As String, ByVal userName As String, ByVal password As String)
- _baseURI = baseUri
- _userName = userName
- _passWord = password
- End Sub
- Public Function getToken() As String
- Dim client = New RestClient(_baseURI)
- Dim request = New RestRequest("/auth/token", Method.POST)
- request.AddHeader("username", _userName)
- request.AddHeader("password", _passWord)
- request.AddHeader("enviroment", "myEnv")
- request.AddHeader("grant_type", "password")
- request.AddHeader("Content-Type", "application/x-www-form-urlencoded")
- Dim response As IRestResponse = client.Execute(request)
- response = client.Execute(request)
- Return response.Content
- End Function
- HTTP Status 404 ? Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/8.5.33</h3></body></html>
- "POST /web/service/auth/token HTTP/1.1" 302 - "-" "RestSharp/105.2.3.0"
- "GET /web/service/auth/token HTTP/1.1" 404 1043 "-" "RestSharp/105.2.3.0"
Add Comment
Please, Sign In to add comment