下面是PowerShell中MQL overview的第一个示例:
$result = Invoke-RestMethod `
-Uri ('https://www.googleapis.com/freebase/v1/mqlread?query={0}' -f `
[System.Web.HttpUtility]::UrlEncode(
(ConvertTo-Json @(@{
type = '/astronomy/planet'; id = @(); name = @();
}))))显示结果:
PS C:\> $result.result
type id name
---- -- ----
/astronomy/planet {/en/earth} {Earth}
/astronomy/planet {/en/venus} {Venus}
/astronomy/planet {/en/mars} {Mars}
/astronomy/planet {/wikipedia/pt_id/1214} {Mercury}
/astronomy/planet {/en/jupiter} {Jupiter}
/astronomy/planet {/en/neptune} {Neptune}
/astronomy/planet {/en/saturn} {Saturn}
/astronomy/planet {/en/uranus} {Uranus} MQL cookbook具有以下示例查询:
{
"q1" : {
"as_of_time" : "2007-01-09T22:00:56.0000Z",
"query" : [
{
"domain" : "/architecture",
"id" : null,
"return" : "count",
"timestamp" : null,
"type" : "/type/type"
}
]
}
}通过PowerShell提交查询的好方法是什么?
发布于 2014-12-14 08:05:21
$result = Invoke-RestMethod `
-Uri (
'https://www.GoogleAPIs.com/freebase/v1/mqlread?' +
('query={0}' -f [System.Web.HttpUtility]::UrlEncode(
(ConvertTo-Json -Depth 100 `
@(
@{
domain = '/architecture';
id = $null;
return = 'count';
timestamp = $null;
type = '/type/type'
}
)
)
)) +
'&as_of_time=2007-01-09'
)https://stackoverflow.com/questions/27348886
复制相似问题