I am trying the fetch data through an API call which requires credentials (API key and password).
I can do it through Python script. I would like to do it through Excel VBA because I want to download the data and formatting in same excel sheet in one click.
I have tried many things through VBA Excel after taking the help from many developer community websites.
Python code snippet -
import requests
import json
api_key = "NotLikeToMention1"
domain = "NotLikeToMention2"
password = "NotLikeToMention3"
r = requests.get("https://"+ domain +".freshdesk.com/api/v2/tickets?filter=new_and_my_open", auth = (api_key, password))
data = r.json()
print(data)
I tried the below code in Excel VBA. I also tried using authorization through setRequestHeader
property. While using these ways, I get an error something like
'credential error, you will have to login'.
Dim response As String
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", address, false, emailId, password
.Send
response = .responseText
End With
Msgbox response