How to Send an HTTPS GET Request with “Authorization: Bearer ” Header
Question:
I’m using VB6. Can you tell me how I would use your software to duplicate this VB6 code snippet?
I can’t seem to find a way to set headers, use OPEN or SEND.
Any help would be appreciated.
' Specify the API URL URL = "..." ' I have the proper URL ' Create the HTTP request object Dim httpRequest As Object Set httpRequest = CreateObject("WinHttp.WinHttpRequest.5.1") ' Open the connection and set the method to GET httpRequest.Open "GET", URL, False ' Set the request headers httpRequest.SetRequestHeader "Authorization", "Bearer " & bearerToken ' Send the request httpRequest.Send ' Check the response status If httpRequest.Status = 200 Then ' Request successful fileContent = httpRequest.ResponseBody end if
Answser:
See the following examples:
AutoIt HTTPS GET with Authorization Bearer Header
C HTTPS GET with Authorization Bearer Header
Python HTTPS GET with Authorization Bearer Header
C++ HTTPS GET with Authorization Bearer Header
C# HTTPS GET with Authorization Bearer Header
DataFlex HTTPS GET with Authorization Bearer Header
Delphi HTTPS GET with Authorization Bearer Header
Visual FoxPro HTTPS GET with Authorization Bearer Header
Go HTTPS GET with Authorization Bearer Header
Java HTTPS GET with Authorization Bearer Header
Objective-C HTTPS GET with Authorization Bearer Header
Perl HTTPS GET with Authorization Bearer Header
PHP ActiveX HTTPS GET with Authorization Bearer Header
PHP HTTPS GET with Authorization Bearer Header
PowerBuilder HTTPS GET with Authorization Bearer Header
PowerShell HTTPS GET with Authorization Bearer Header
Swift HTTPS GET with Authorization Bearer Header
Tcl HTTPS GET with Authorization Bearer Header
VB6 HTTPS GET with Authorization Bearer Header
VB.NET HTTPS GET with Authorization Bearer Header
VBScript HTTPS GET with Authorization Bearer Header
Xojo HTTPS GET with Authorization Bearer Header