Reputation: 395
I am trying to run an API via tinyurl.com, which requires an authentication token.
I think the authentication works. I used to get an authentication error, but now I don't.
I can't figure out how to accept the long URL to shorten.
The error I get:
The URL field is required
Function GetTinyUrl(LongURL As String) As String
Dim xml
Set xml = CreateObject("WinHttp.WinHttpRequest.5.1")
xml.Open "POST", "https://api.tinyurl.com/create", False
xml.setrequestheader "Authorization", "Bearer " & "my api token"
xml.setrequestheader "url", LongURL
GetTinyUrl = xml.responseText
Set xml = Nothing
End Function
How might I "send" my long url via this API?
Upvotes: 1
Views: 173