API-FOOTBALL

फ्रीमियम
Verified
द्वारा API-SPORTS | अपडेट किया गया 8 days ago | Sports
लोकप्रियता

10 / 10

लेटेंसी

365ms

सेवा का स्तर

99%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Missing API-KEY error

Rapid account: Thirzahemert
thirzahemert
2 years ago

Hi,

Whenever I try to send a request via my app, and even when testing endpoint on here, it gives the following error.

“errors”:{1 item
"token":“Error/Missing application key. Go to https://www.api-football.com/documentation-v3 to learn how to get your API application key.”
}

Even though the API_KEY is there, and I’m using the code snippet that is automatically generated.

Rapid account: Wmxnwzfw
wmxnwzfw Commented 2 years ago

I’d just consult the documentation on whatever you are using to call the API with (OKHttp in your case). You only need to pass two header parameters, the rest are on the query string, so it’s not complicated. I’d rely on your library’s documentation rather than some generated code.

Postman is a good tool for testing calling the APIs and you can save all your requests in collections. It can also generate OkHttp from a request, which looks a bit different to the code generated on here.

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url(“https://api-football-v1.p.rapidapi.com/whatever”)
.method(“GET”, null)
.addHeader(“x-rapidapi-key”, “whatever”)
.build();
Response response = client.newCall(request).execute();

Rapid account: Thirzahemert
thirzahemert Commented 2 years ago

@christatedavies When I test the endpoint under the endpoints tab it doesn’t work either. I’m not pasting anything, literally just testing the code snippet it has automatically generated for me when I select Java(OkHttp) and click “Test endpoint”

Rapid account: Christatedavies
christatedavies Commented 2 years ago

Make sure you’ve correctly pasted the syntax

CURLOPT_HTTPHEADER => [
‘x-rapidapi-host’: ‘api-football-v1.p.rapidapi.com’,
‘x-rapidapi-key’: ‘{your key here}’
]

Is NOT the same as

CURLOPT_HTTPHEADER => [
‘x-rapidapi-host: api-football-v1.p.rapidapi.com’,
‘x-rapidapi-key: {your key here}’
]

Subtle difference, but a difference that matters

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें