问题
I'm new to Postman and APIs in general. I have a need to pass multiple param values for the same key to a GET with Postman.
I want the end result to be a listing of all "features" corresponding to the param values passed to the GET call for the key "id".
I've researched and tried every permutation found on SO and other boards with zero luck. I even tried the same variations using POST with even worse results. So....posting here in hopes that someone can help.
Here's what I've tried so far:
GET https://URL/api/feature?id=SdxApTWLym1n3D5-hR-QOvwaklo
Returns the expected feature
GET https://URL/api/feature?id=MzqDzjNch3vZ4c9R54I5AtDgwCw
Returns the expected feature
GET https://URL/api/feature?id=SdxApTWLym1n3D5-hR-QOvwaklo&id=MzqDzjNch3vZ4c9R54I5AtDgwCw
Returns just the feature associated with SdxApTWLym1n3D5-hR-QOvwaklo
GET https://URL/api/feature?id[]=SdxApTWLym1n3D5-hR-QOvwaklo&id[]=MzqDzjNch3vZ4c9R54I5AtDgwCw
Returns ALL features
GET https://URL/api/feature?where={"id":["SdxApTWLym1n3D5-hR-QOvwaklo","MzqDzjNch3vZ4c9R54I5AtDgwCw"]}
Returns ALL features
Is what I'm doing possible? If so, I'd appreciate suggestions.
Thanks!
回答1:
You could try arrays as have been advised.
An example is:
KEY VALUE
id [{"column1":"value1"},{"column2":"value2"}]
or
KEY VALUE
id [{"column1":"value1","column2":"value2"},{"column3":"value3","column4":"value4"}]
API should be capable of processing such structures.
回答2:
Put in the address bar the endpoint.
Put in Params tab required values:
KEY VALUE
id[] SdxApTWLym1n3D5-hR-QOvwaklo
id[] MzqDzjNch3vZ4c9R54I5AtDgwCw
Run the request in the POSTMAN.
来源:https://stackoverflow.com/questions/51638364/how-to-pass-multiple-param-values-for-the-same-key-to-get-with-postman