Rest QLIK感知休息请求
我使用下面的URL建立了Qlik意义上的REST连接,但是我使用的URL将只返回玩家ID为237的数据。我想返回播放器库下的所有数据,而不是一个特定的ID 我试过用星号*代替237,但没有用,我想知道查询参数或查询标题字段是否是解决方案。我看到的所有填充REST连接表单的示例都很简单,在这种情况下没有任何帮助。您不能用*替换播放器,而是希望获得所有数据。RESTAPI不是这样工作的。理想情况下,您应该有球员,例如Endpoint,它应该返回包含所有球员(包括他们id)的列表,然后循环遍历所有球员或其子集以获得更多细节。据我所知,football-api.com api文档中没有这样的端点。如果他们能向您提供此类信息,最好联系他们的支持团队 在Qlik中,此解决方案可能如下所示:Rest QLIK感知休息请求,rest,qlikview,qliksense,Rest,Qlikview,Qliksense,我使用下面的URL建立了Qlik意义上的REST连接,但是我使用的URL将只返回玩家ID为237的数据。我想返回播放器库下的所有数据,而不是一个特定的ID 我试过用星号*代替237,但没有用,我想知道查询参数或查询标题字段是否是解决方案。我看到的所有填充REST连接表单的示例都很简单,在这种情况下没有任何帮助。您不能用*替换播放器,而是希望获得所有数据。RESTAPI不是这样工作的。理想情况下,您应该有球员,例如Endpoint,它应该返回包含所有球员(包括他们id)的列表,然后循环遍历所有球员
// Lets imagine that this table is the API response that
// returns list with all players
Players:
Load * Inline [
playerId
1
2
3
4
5
];
// Loop through all values in playerId field
for i = 0 to FieldValueCount('playerId')
// vPlayerId variable will hold the current iteration player id
let vPlayerId = FieldValue('playerId', $(i))
// Load player data. The player id variable is in the url
Details:
Load
*
From
http://api.football-api.com/2.0/$(vPlayerId)/237?Authorization=0123456789
;
next
// We can drop the Players table if not needed anymore
Drop Table Players;
顺便说一句,不要在互联网上放置授权密钥之类的东西 您可以使用变量而不是数字 我无法查看数据,因为我没有授权,需要知道URL中playerID的总数
// Variable setting, Total Row of PlayerID's Number.
let Id = FieldValue('playerId', 1);
//or
let Id = total number;
// Loop Start
for start = 1 to $(ID)
// exampleQuery
RestConnectorMasterTable:
SQL SELECT
"__KEY_...."
(SELECT ....
FROM ...)
FROM XML ...
WITH CONNECTION(Url "http://api.football-api.com/2.0/player/$(start)?Authorization=0123456789");
/* put a variable instead of ID's number in the WITH CONNECTION statement. */
// Loop End
Next start;
Play:
Load *
Resident RestConnectorMasterTable
Where Not IsNull([__FK_...]);
Drop table RestConnectorMasterTable;
我希望您觉得这对您有所帮助:
--附加的--
我检查了api
简单地运行从1到数字的循环将导致404错误。
不存在参数
你需要9002队的球员身份证吗?
如果是这样,9002队的球员id可以在根目录下找到。
休息连接→ 选择要加载的数据→ 根>小队
因此,您可以先获取班表的id字段,然后在id上循环。
第一步
将Rest连接器连接到团队API。
团队的参数是9002
步骤2
单击选择要加载的数据以选择根目录下的班数据。
而且只有id字段进入了球队表格。共28行
stpe 3
在现有播放器id RestConnector选项中将分页类型设置为Custom。
创建WITHCONNECTION语句。
步骤4
请参阅下面的脚本并执行Load。
结果如下:
希望您得到想要的结果:D文档:
假设玩家id是必需的,您不能使用*下载所有内容
我认为绕过它的一种方法是,像使用循环一样,分块逐个询问玩家:
FOR i=1 to 1000
// your code here just get player using $(i) as id
// you can save also player data as qvd so you will not ask another time for that
// (most api have plimitation with number of calls)
NEXT i
FOR i=1 to 1000
// your code here just get player using $(i) as id
// you can save also player data as qvd so you will not ask another time for that
// (most api have plimitation with number of calls)
NEXT i