1

I have an api link as following

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

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

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

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 encodes the query object and passes it as a query parameter.

For example, the following query object:

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

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

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

Santosh
  • 2,355
  • 10
  • 41
  • 64
  • 4
    Just click the Params button and add it as a key pair. Postman should encode anything needing encoding. – Paul Samsotha Jul 13 '16 at 00:51
  • how do I pass it as a single object querystring. I mean i can pass like query?dataset=my_data and so on..But I want to pass it as single object querystring like query?query=dataset and so on.It's more understandable if we look at the encoded url – Santosh Jul 13 '16 at 00:56
  • What _exactly_ is the problem? Please read through [ask]. – SiKing Jul 13 '16 at 15:36
  • Also, are you doing this in [tag:postman] or in [tag:soapui]? – SiKing Jul 13 '16 at 15:37

2 Answers2

1

Seems trivial but just use Postman and do a GET to the URL you provided:

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
Marc
  • 13,011
  • 11
  • 78
  • 98
1

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
Rodrigo Vasconcelos
  • 1,270
  • 2
  • 14
  • 26