Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI - I am trying to create a REST API Data connection to a Football Prediction website
The rest code generated below works in a test harness outside of Qlik.
But I am unsure of how to set up the data connection and what goes where to connect.
package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://football-prediction-api.p.rapidapi.com/api/v2/predictions?iso_date=2018-12-01&market=classic&federation=UEFA" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-rapidapi-host", "football-prediction-api.p.rapidapi.com") req.Header.Add("x-rapidapi-key", "xxxxxxxxxx32b4f9ap13e9c5jsn5e425aec9f10") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
Solved for those interested - this set pulls back all Leagues from the API for the UK as an example
Needed to add a header section to the API connection
LIB CONNECT TO 'REST_httpsapi-football-v1.p.rapidapi.comv2leaguescountry{country_name}{season}';
RestConnectorMasterTable:
SQL SELECT
"__KEY_api",
(SELECT
"league_id",
"name",
"type",
"country",
"country_code",
"season",
"season_start",
"season_end",
"logo",
"flag",
"standings" AS "standings_u0",
"is_current",
"__KEY_leagues",
"__FK_leagues",
(SELECT
"standings",
"players",
"topScorers",
"predictions",
"odds",
"__KEY_coverage",
"__FK_coverage",
(SELECT
"events",
"lineups",
"statistics",
"players_statistics",
"__FK_fixtures"
FROM "fixtures" FK "__FK_fixtures")
FROM "coverage" PK "__KEY_coverage" FK "__FK_coverage")
FROM "leagues" PK "__KEY_leagues" FK "__FK_leagues")
FROM JSON (wrap off) "api" PK "__KEY_api";
[fixtures]:
LOAD [events],
[lineups],
[statistics],
[players_statistics],
[__FK_fixtures] AS [__KEY_coverage]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_fixtures]);
[coverage]:
LOAD [standings],
[players],
[topScorers],
[predictions],
[odds],
[__KEY_coverage],
[__FK_coverage] AS [__KEY_leagues]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_coverage]);
[leagues]:
LOAD [league_id],
[name],
[type],
[country],
[country_code],
[season],
[season_start],
[season_end],
[logo],
[flag],
[standings_u0] AS [standings_u0],
[is_current],
[__KEY_leagues],
[__FK_leagues] AS [__KEY_api]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_leagues]);
[api]:
LOAD [__KEY_api]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_api]);
DROP TABLE RestConnectorMasterTable;
Solved for those interested - this set pulls back all Leagues from the API for the UK as an example
Needed to add a header section to the API connection
LIB CONNECT TO 'REST_httpsapi-football-v1.p.rapidapi.comv2leaguescountry{country_name}{season}';
RestConnectorMasterTable:
SQL SELECT
"__KEY_api",
(SELECT
"league_id",
"name",
"type",
"country",
"country_code",
"season",
"season_start",
"season_end",
"logo",
"flag",
"standings" AS "standings_u0",
"is_current",
"__KEY_leagues",
"__FK_leagues",
(SELECT
"standings",
"players",
"topScorers",
"predictions",
"odds",
"__KEY_coverage",
"__FK_coverage",
(SELECT
"events",
"lineups",
"statistics",
"players_statistics",
"__FK_fixtures"
FROM "fixtures" FK "__FK_fixtures")
FROM "coverage" PK "__KEY_coverage" FK "__FK_coverage")
FROM "leagues" PK "__KEY_leagues" FK "__FK_leagues")
FROM JSON (wrap off) "api" PK "__KEY_api";
[fixtures]:
LOAD [events],
[lineups],
[statistics],
[players_statistics],
[__FK_fixtures] AS [__KEY_coverage]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_fixtures]);
[coverage]:
LOAD [standings],
[players],
[topScorers],
[predictions],
[odds],
[__KEY_coverage],
[__FK_coverage] AS [__KEY_leagues]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_coverage]);
[leagues]:
LOAD [league_id],
[name],
[type],
[country],
[country_code],
[season],
[season_start],
[season_end],
[logo],
[flag],
[standings_u0] AS [standings_u0],
[is_current],
[__KEY_leagues],
[__FK_leagues] AS [__KEY_api]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_leagues]);
[api]:
LOAD [__KEY_api]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_api]);
DROP TABLE RestConnectorMasterTable;
Hi
I'm having the same problem with the REST API Data connection to the API-Football
I can't connect to the server. Can you publish a screenshot over your settings in the connection?
Thanks in advance!
Br
Fredrik