title: Loop through multiple cURL api request body parameters using Bash script
body: <p>I want to convert multiple audio files to text using Google Cloud's Speech Recognize API. </p>
  
  <p>I successfully transcribed one audio file called '1.flac'...</p>
  
  <p>Request:</p>
  
  <pre><code>curl -s -H "Content-Type: application/json" \
  -H "Authorization: Bearer ACCESSTOKEN" \
  https://speech.googleapis.com/v1/speech:recognize \
  -d '
  {"config": {"languageCode": "pt-BR", "audioChannelCount": 2},"audio":{"uri": "gs://PROJECTID/1.flac"}}
  ' 
  </code></pre>
  
  <p>Response: </p>
  
  <pre><code>{
    "results": [
      {
        "alternatives": [
          {
            "transcript": "cat",
            "confidence": 0.9999999
          }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>I successfully generated multiple lines for the data/body portion of the above request...</p>
  
  <p>Request:</p>
  
  <pre><code>for i in 1 2 3
  do
  echo "{\"config\": {\"languageCode\": \"pt-BR\", \"audioChannelCount\": 2},\"audio\":{\"uri\": \"gs://PROJECTID/$i.flac\"}}"
  done
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>{"config": {"languageCode": "pt-BR", "audioChannelCount": 2},"audio":{"uri": "gs://PROJECTID/1.flac"}}
  {"config": {"languageCode": "pt-BR", "audioChannelCount": 2},"audio":{"uri": "gs://PROJECTID/2.flac"}}
  {"config": {"languageCode": "pt-BR", "audioChannelCount": 2},"audio":{"uri": "gs://PROJECTID/3.flac"}}
  </code></pre>
  
  <p>How can I combine these two scripts, so that the curl API executes once for each of the three files, with one response like this:</p>
  
  <pre><code>{
        "results": [
          {
            "alternatives": [
              {
                "transcript": "cat",
                "confidence": 0.9999999
              }
            ]
          }
        ]
      }
  {
        "results": [
          {
            "alternatives": [
              {
                "transcript": "dog",
                "confidence": 0.9999999
              }
            ]
          }
        ]
      }
  {
        "results": [
          {
            "alternatives": [
              {
                "transcript": "horse",
                "confidence": 0.9999999
              }
            ]
          }
        ]
      }
  </code></pre>