---
title: Sending an Array of Values in a GET Request
description: If you need to send multiple values in a GET request here is a simple way.
date: 2022-02-15
tags: REST, APIs
source: https://brianchildress.co/blog/sending-array-of-values-in-get-request
---

# Sending an Array of Values in a GET Request

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:

```js
const express = require('express');
const app = express();

...

app.get('/users', (req,res)=>{
  const usernames = req.query.username.split(';');
  console.log(usernames); // ['bob', 'sally', 'john']
  res.send('Found users');
})
```

This quick and simple option can be extended for more use cases, but this meets the needs of most APIs.
