Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come my request returns Invalid_Api_Key? Simple HTTPS

local HttpService = game:GetService("HttpService")
local url = "https://fortnite-public-api.theapinetwork.com/prod09/upcoming/get"
local api = {['Key']="5515aff128c1280bc37c6080265619bd"}
local response = HttpService:GetAsync(url,false,api)
 

local data = HttpService:JSONDecode(response)
for _,v in pairs(data) do
	print (v)
end

Its attempting to decode the 'url' and parse it.

The API Key is brand new, and i've tried this using multiple keys, none working.

1 answer

Looking at the documentation, the API is expecting you to make a POST request with the Authorization token as a header. You're attempting to make a GET request with some "Key" header.

local authHeader = "Authorization: yourAPIKey"
local response = HttpService:PostAsync(url, "", Enum.HttpContentType.ApplicationJson, false, authHeader)

Also, don't post your API keys into the public. And next time when posting a question about a less-known third-party-service, please provide a link to the service and its documentation.

This discussion is preserved as it was. New answers, comments, and votes are closed.