title: How to make three POST requests using node-fetch
body: <p>I am making POST requests to an API and I want to make three requests as efficient and with less code as possible. Currently my code works, but it sends only the first object, instead of all three, what is the most efficient way to make three API calls? Here is my attempt so far:</p>
  <pre><code>import fetch from 'node-fetch';
  import xlsx from 'xlsx';
  const baseUrl = &quot;&quot;;
  const apiToken = &quot;&quot;;
  const wb = xlsx.readFile('users.xlsx');
  const ws = wb.Sheets['users'];
  const data = xlsx.utils.sheet_to_json(ws);
  
  let [obj1, obj2, obj3] = data
  
  const optionsForFirstUser = {
    method: &quot;POST&quot;,
    headers: {
      Authorization: `Bearer ${apiToken}`,
      &quot;gtmhub-accountid&quot;: accountId,
      &quot;Content-type&quot;: &quot;application/json; charset=UTF-8&quot;,
      Accept: &quot;application/json, text/plain, */*&quot;,
    },
   
  
    body: JSON.stringify(
      obj1
    ),
  };
  
  const optionsForSecondUser = {
    method: &quot;POST&quot;,
    headers: {
      Authorization: `Bearer ${apiToken}`,
      &quot;gtmhub-accountid&quot;: accountId,
      &quot;Content-type&quot;: &quot;application/json; charset=UTF-8&quot;,
      Accept: &quot;application/json, text/plain, */*&quot;,
    },
   
  
    body: JSON.stringify(
      obj1
    ),
  };
  
  const optionsForThirdUser = {
    method: &quot;POST&quot;,
    headers: {
      Authorization: `Bearer ${apiToken}`,
      &quot;gtmhub-accountid&quot;: accountId,
      &quot;Content-type&quot;: &quot;application/json; charset=UTF-8&quot;,
      Accept: &quot;application/json, text/plain, */*&quot;,
    },
   
  
    body: JSON.stringify(
      obj1
    ),
  };
  
  
  const createUser = (url, settings) =&gt; {
    return fetch(`${url}/users`, settings)
      .then((response) =&gt; response.text())
      .then((data) =&gt; console.log(data))
      .catch((error) =&gt; {
        console.log(error.message);
      });
  };
  
  createUser(baseUrl, optionsForFirstUser, optionsForSecondUser, optionsForThirdUser);
  
  </code></pre>
  <p>I can't use an array, because the API doesn't allow it. It needs to be just JSON objects.</p>