我有一个api链接如下
https://hostaddress.com/api/v1/query
API目前支持一个端点:查询。查询端点允许用户进行查询。
必须使用GET HTTP方法访问查询端点。
必须使用GET HTTP方法发送对查询端点的请求。必需的查询参数定义要执行的查询。它是一个URL编码的JSON对象,并作为参数传递给请求。
URL对查询对象进行编码,并将其作为查询参数传递。
例如,以下查询对象:
{
"dataset": "my_data",
"view": "time",
"start": 1458250809000,
"end": 1458250810000,
"timezone_offset": -25200000,
"measure": {
"aggregator": "unique_count",
"column": "impression"
},
"filter": "`action.event` = \"appDownloadLink\"",
"sampled": true,
"group_by": ["browser_type"],
"max_groups": 10,
"compute_all_others": false
}
如何通过将查询对象作为查询字符串传递来测试POSTMAN的响应?
答案 0 :(得分:1)
看起来很简单但只是使用Postman并对你提供的URL进行GET:
https://hostaddress.com/api/v1/query?query=%7B%22dataset%22%3A%20%E2%80%9Cmy_data%E2%80%9D%2C%20%22start%22%3A%201458250809000%2C%20%22end%22%3A%201458250810000%2C%20%22timezone_offset%22%3A%20-25200000%2C%20%22view%22%3A%20%E2%80%9Ctime%E2%80%9D%2C%20%22measure%22%3A%20%7B%22aggregator%22%3A%20%E2%80%9Cunique_count%E2%80%9D%2C%20%22column%22%3A%20%E2%80%9Cimpression%E2%80%9D%7D%2C%20%22filter%22%3A%20%E2%80%9C%60action.event%60%20%3D%20%5C%22appDownloadLink%5C%22%E2%80%9D%2C%20%22sampled%22%3A%20true%2C%20%22group_by%22%3A%20%5B%E2%80%9Cbrowser_type%E2%80%9D%5D%2C%20%22max_groups%22%3A%2010%2C%20%22compute_all_others%22%3A%20false%7D
答案 1 :(得分:1)
对于任何偶然发现谷歌搜索解决方案的人,您可以使用括号在邮递员中包含嵌套查询参数,如下例所示(使用OP提到的对象):
https://hostaddress.com/api/v1/query?dataset=my_data&measure[aggregator]=unique_count&measure[column]=impression&compute_all_others=false