Sometimes you might need to send multiple values for a given parameter in a GET request to your API. For example, you have a GET /users
API endpoint and you want to lookup information on several users at once. You might want your query to look something like: /users?username=bob;sally;john
. This can work well for most data by using a delimiter like the ;
.
In Express, our GET /users
endpoint might look like:
1 | const express = require('express'); |
This quick and simple option can be extended for more use cases, but this meets the needs of most APIs.