Reputation: 57
I am trying to make a small stat checking app for Fortnite Battle Royale. The TRN Api requires a key to be sent, which I do not have a clue how to do. Thanks in advance.
Public Class Form1
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
Dim webClient As New System.Net.WebClient
Dim Platform As String = ""
Dim UName As String = ""
Dim TRNApiKey As String = "f4d79aad-381b-4b91-87f1-2a1c2ee14cb6"
Dim fortniteStatslookup As String
Dim URL As String
Select Case cboPlatform.Text
Case = "PC"
Platform = "pc"
Case = "Xbox"
Platform = "xbl"
Case = "Playstation"
Platform = "psn"
End Select
UName = txtUName.Text
URL = "https://api.fortnitetracker.com/v1/profile/" & Platform & "/" & UName
webClient.Headers.Add("f4d79aad-381b-4b91-87f1-2a1c2ee14cb6", URL)
fortniteStatslookup = webClient.DownloadString(URL)
txtOutput.Text = fortniteStatslookup
End Sub
End Class
Upvotes: 0
Views: 928
Reputation: 105
See: MSDN Webclient.Headers documentation
System.Net.WebClient.Headers take a key-value pair, so you will want something like:
webClient.Headers.Add("key", "f4d79aad-381b-4b91-87f1-2a1c2ee14cb6")
or
webClient.Headers.Add("APIkey", "f4d79aad-381b-4b91-87f1-2a1c2ee14cb6")
Upvotes: 1