API-FOOTBALL

フリーミアム
Verified
よって API-SPORTS | 更新済み hace 15 días | Sports
人気

10 / 10

レイテンシー

369ms

サービスレベル

100%

Health Check

N/A

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

Scripting Error

Rapid account: Soccerates
soccerates
hace 6 años

Hi,

This looks like an awesome API and I’ve been slowly trying to incorporate it into my needs. I’m currently working with Google Sheets Script Editor and I’m able to connect to the API and get a general list of results, but I keep getting an error when trying to call specific data points. I’m not quite sure what I’m doing wrong (sorry, I’m new to this!). Specifics below.

Any assistance would be great! Thank you.

TypeError: Cannot read property “0” from undefined. (line 28, file “Code”)

Code:
var response = UrlFetchApp.fetch(“https://api-football-v1.p.mashape.com/fixtures/league/2”,options)
var json = response.getContentText();
var data = JSON.parse(json);
//Logger.log(response.getContentText());
Logger.log(data);
Logger.log(data[“api”][“results”][“fixtures”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“event_date”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“round”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“homeTeam”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“awayTeam”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“goalsHomeTeam”]);
Logger.log(data[“api”][“results”][“fixtures”][0][“goalsAwayTeam”]);

Rapid account: Api Sports
api-sports Commented hace 6 años

Hello,

I sent you the correction of your code by mail. This will have to work. Do not hesitate to consult the documentation on the structure of the data returned by the API.

Rapid account: Soccerates
soccerates Commented hace 6 años

Hi

I sent an email on 9/7 with my code.

Thanks
Andrew

Rapid account: Api Sports
api-sports Commented hace 6 años

Hi,

Please contact us at "apifootball.contact@gmail.com" and send us a part of your script.

Thanks

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

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