如何使用邮递员(或SOAP UI / Fiddler)中的查询字符串测试API [英] How to test an API with query string from postman(or SOAP UI/Fiddler)

查看:101
本文介绍了如何使用邮递员(或SOAP UI / Fiddler)中的查询字符串测试API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下所示的api链接

I have an api link as following

https://hostaddress.com/api/v1/query

该API当前支持一个端点:查询。查询端点允许用户进行查询。

The API currently supports one endpoint: query. The query endpoint allows the user to make queries.

必须使用GET HTTP方法访问查询端点。

The query endpoint must be accessed with the GET HTTP method.

对查询端点的请求必须使用GET HTTP方法发送。必需的查询参数定义要执行的查询。它是一个JSON对象,该对象经过URL编码并作为参数传递给请求。

Requests to the query endpoint must be sent with the GET HTTP method. The required query parameter defines the query to be executed.It is a JSON object that is URL-encoded and passed as a parameter to the request.

URL对查询对象进行编码并将其作为查询参数传递。

URL encodes the query object and passes it as a query parameter.

例如,以下查询对象:

{
 "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
}

将被URL编码并作为以下查询参数传递:
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%22sam已承诺%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

would be URL encoded and passed as the following query parameter: 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

我如何通过将查询对象作为querystring传递来测试POSTMAN的响应?

How do i test for the response from POSTMAN by passing the query object as querystring?

推荐答案

对于偶然发现google搜索解决方案的人,您可以使用方括号将嵌套的查询参数包含在邮递员中,例如以下示例(

For anyone who stumbled here google searching a solution, you can include nested query parameters in postman using brackets, like in the following example (using the object mentioned by the OP):

https://hostaddress.com/api/v1/query?dataset=my_data&measure[aggregator]=unique_count&measure[column]=impression&compute_all_others=false

这篇关于如何使用邮递员(或SOAP UI / Fiddler)中的查询字符串测试API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆