API-FOOTBALL

フリーミアム
Verified
よって API-SPORTS | 更新済み 11일 전 | Sports
人気

10 / 10

レイテンシー

364ms

サービスレベル

100%

Health Check

N/A

すべてのディスカッションに戻る

Error "Missing RapidAPI application key"

Rapid account: St Reich
StReich
5 वर्ष पहले

When i just copy and paste the response example then i get the error:“Missing RapidAPI application key”.

I am using the newest version of unirest-php.

I have no idea why its not working. Can you please help me.

Greetings
Stephan

here ist my php-code:

<?php
require_once “…/unirest-php/src/Unirest.php”;

// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest\Request::get(“https://api-football-v1.p.mashape.com/fixtures/league/2”,
array(
“X-Mashape-Key” => “longCode”,
“Accept” => “application/json”
)
);

print_r($response->headers);

?>

Rapid account: Giri 3072
giri3072 Commented 3 वर्ष पहले

Hi Api-sports

I am having the same issue with Python. Tried to use the below code with my key.


conn = http.client.HTTPSConnection("v3.football.api-sports.io")

headers = {
    'x-rapidapi-host': "v3.football.api-sports.io",
    'x-rapidapi-key': "XxXxXxXxXxXxXxXxXxXxXxXx"
    }

conn.request("GET", "/venues?id=556", headers=headers)

res = conn.getresponse()
data = res.read()


All it says missing application key. 
Rapid account: Manvendrachaudhary
manvendrachaudhary Commented 4 वर्ष पहले

The Same Error Coming With Me, I am Using Daily Horoscope API for AstrologerYogendra.in
I am Using POSTMAN to Test API Working, Then Same Error of RAPID API Key Occur
Do You Have Any Solution For It

That is The End URL: https://horoscopeapi-horoscope-v1.p.rapidapi.com/daily

Rapid account: Api Sports
api-sports Commented 5 वर्ष पहले

ok cool, let’s go enjoy the API 😃

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

i finally found a solution myself: <?php
headers=array(XRapidAPIKey:mykey);headers =array('X-RapidAPI-Key: mykey'); ch = curl_init();
curl_setopt(ch,CURLOPTURL,"https://apifootballv1.p.rapidapi.com/fixtures/league/2");curlsetopt(ch, CURLOPT_URL,"https://api-football-v1.p.rapidapi.com/fixtures/league/2"); curl_setopt(ch, CURLOPT_HTTPHEADER, headers);curlsetopt(headers); curl_setopt(ch, CURLOPT_RETURNTRANSFER, true);
response=curlexec(response = curl_exec (ch);
curl_close (ch);vardump(ch); var_dump(response);
?>

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

i tried this:

<?php
headers=array(XRapidAPIKey:ascdefghijklmnopqrstuvwxyz);headers =array('X-RapidAPI-Key: ascdefghijklmnopqrstuvwxyz'); ch = curl_init();
curl_setopt(ch,CURLOPTURL,"https://apifootballv1.p.rapidapi.com/fixtures/league/2");curlsetopt(ch, CURLOPT_URL,"https://api-football-v1.p.rapidapi.com/fixtures/league/2"); curl_setopt(ch, CURLOPT_HEADER, headers);curlsetopt(headers); curl_setopt(ch, CURLOPT_POST, 1);
curl_setopt(ch,CURLOPTPOSTFIELDS,httpbuildquery(array()));curlsetopt(ch, CURLOPT_POSTFIELDS, http_build_query(array())); curl_setopt(ch, CURLOPT_RETURNTRANSFER, true);
response=curlexec(response = curl_exec (ch);
curl_close (ch);printr(ch); print_r(response);
?>

which means i changed the CURLOPT_HTTPHEADER in CURLOPT_HEADER an got this:

HTTP/1.1 401 Unauthorized Content-Type: application/json Date: Sat, 05 Jan 2019 08:18:41 GMT Server: RapidAPI-1.0.2 X-RapidAPI-Proxy-Response: true Content-Length: 139 Connection: keep-alive {“message”:“Missing RapidAPI application key. Go to https://docs.rapidapi.com/docs/keys to learn how to get your API application key.”}

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

by the way: this postings here suck cause it deletes the line spacings.<br>
not good.

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

I can’t believe this answert tbh. There is a known bug in the Unirest api that is not sending the API key ? this means that it’s totally useless ?!?

Am i the only one using php ?

by the way: when i use the Curl script that Ken from the support sent me, i get this:
{“message”:“Endpoint/fixtures/league/2 does not exist”}

isn’t there ANY way to use the API ???

Greetings
Stephan

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

Okay. so this is the answer of the Rapidapi support:

>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Ken Ni (RapidAPI)
Jan 4, 16:29 PST

Hi Stephan,

It seems like there is an issue with our Unirest for Php as it seems like the “RapidAPI key” isn’t being appended to the API request.

I would recommend using a different request library to call this endpoint. This is a known bug with appending the body parameters in Unirest with PHP. You can do something like the following to call the endpoint:

<?php
headers=array(XMashapeKey:);headers =array('X-Mashape-Key: ***'); ch = curl_init();
curl_setopt(ch,CURLOPTURL,"https://apifootballv1.p.mashape.com/fixtures/date/03.01.2019");curlsetopt(ch, CURLOPT_URL,"https://api-football-v1.p.mashape.com/fixtures/date/03.01.2019"); curl_setopt(ch, CURLOPT_HTTPHEADER, headers);curlsetopt(headers); curl_setopt(ch, CURLOPT_POST, 1);
curl_setopt(ch,CURLOPTPOSTFIELDS,httpbuildquery(array()));curlsetopt(ch, CURLOPT_POSTFIELDS, http_build_query(array())); curl_setopt(ch, CURLOPT_RETURNTRANSFER, true);
response=curlexec(response = curl_exec (ch);
curl_close ($ch);
echo $response;
?>

Best,
Ken
>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<

Rapid account: Api Sports
api-sports Commented 5 वर्ष पहले

This is the first time I’ve had this bug reported to us, normally if your KEY is running on MASHAPE it’s supposed to work with unirest or another library without any problems.

Keep us informed of the return of the mashape holder.

Rapid account: St Reich
StReich Commented 5 वर्ष पहले

how is it possible, that the key is working in the Endpoint-test here on this site but not from my server ?
I am clueless.

ディスカッションに参加しましょう-以下にコメントを追加してください:

ログイン/サインアップして新しいコメントを投稿