xruptronics xruptronics - 7 months ago 134
Node.js Question

Array as parameter in GET request in Postman

I have to send array of ids in GET request as paramenter.How can I test it in Postman(google chrome extension for API testing)?

The scenario is I have url, www.something.com/activity/poi_ids

poi_ids should conatain arrays of ids like [316,318]

At api side using express,

var poi_ids = req.params.poi_ids;

I have looked into it but it is only for post request


It is unstructured text. If you want to "send an array" then you'll need to design some way to encode it and then write JavaScript to decode it.

For example:

GET /activity/316-318


var poi_ids = req.params.poi_ids.split("-");