我正在尝试在YQL查询中隐藏API密钥。为此,我尝试遵循this post(也由同一作者here进行了解释)。当我尝试使用URI模板运行查询时,收到以下警告:
"warning": "Missing template variables (BungieAPIKey)"
以下是我已采取的步骤:
yql.storage.admin
将API密钥保存在insert into yql.storage.admin (value) values ("set BungieAPIKey='YOUR_KEY' on uritemplate;")
中https://developer.yahoo.com/yql/console/?env=store://XXXXXXXXXX
)将环境加载到控制台中>]select * from json where url in (select url from uritemplate where template='http://bungie.net/videos/{BungieAPIKey}/{user}/{page}' and user='foo' and page='bar')
这里是返回的JSON:
{ "query": { "count": 0, "created": "2015-01-13T16:58:57Z", "lang": "en-US", "diagnostics": { "publiclyCallable": "true", "warning": "Missing template variables (BungieAPIKey)", "redirect": { "from": "http://bungie.net/videos//foo/bar", "status": "301", "content": "http://www.bungie.net/videos/foo/bar" }, "url": { "execution-start-time": "0", "execution-stop-time": "573", "execution-time": "573", "http-status-code": "404", "http-status-message": "Not Found", "content": "http://bungie.net/videos//foo/bar" }, "error": "Invalid JSON document http://bungie.net/videos//foo/bar", "user-time": "574", "service-time": "573", "build-version": "0.2.212" }, "results": null } }
为了缩小问题范围,我在干净的YQL控制台(未设置环境)中尝试了以下查询:
set BungieAPIKey='YOUR_KEY' on uritemplate; select url from uritemplate where template='http://bungie.net/videos/{BungieAPIKey}/'
Running this也给我同样的警告。 为什么我的模板变量不从我设置为环境变量的位置提取?
我正在尝试在YQL查询中隐藏API密钥。为此,我已尝试关注此帖子(在此由同一作者也进行了解释)。当我尝试使用URI模板运行查询时,得到...
似乎uritemplate上的set x ='y'出于某种原因未得到认可。如果没有此选项,则可以选择有一个自定义表,该表接受一个类型化的参数,例如apiKey。然后,您可以具有以下内容: