title: Request must have at least one newMediaItem - Google Photos API
body: <p>I'm trying to create media item using Google Photos API. Endpoint is documented <a href="https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate" rel="nofollow noreferrer">here</a>. If I copy and paste my payload to an API explorer which can be found in documentation, I get success:
  <a href="https://i.stack.imgur.com/UH3ik.png" rel="nofollow noreferrer">Request inputed to an API Explorer</a> and <a href="https://i.stack.imgur.com/tM36l.png" rel="nofollow noreferrer">Successful  response</a>.</p>
  <p>If I do the same in my node js program, I'm getting an error.</p>
  <p>This is what I do:</p>
  <pre><code>const accessToken = &quot;MyAccessToken&quot;;
  payload = {
      &quot;newMediaItems&quot;: [
          {
              &quot;description&quot;: &quot;picture&quot;,
              &quot;simpleMediaItem&quot;: {
                  &quot;uploadToken&quot;: &quot;CAIS+QIASsyg4OQLX2Ao5hy6I734/b01mjk3Mqpom6DQ24iv7ZfAYLiXAy0WpOXCWJBNHrmBs6FE+a9Axu5CML+Ryu4VGawyf4skxM763mzC5GcjMY4rS/r6IwOekBIoE/aMJLJpRr1gW8jdhVJM89+kioTx9d+shyYeQDbVI8ezb1lXGp6irc9hZl7QA6xd+msXzbLD5nb+wc5CA6du95tP3buh5R5N/Knn+NwByebdEPCusl+X3p7DZ6ha72kLthUqdvwFsp8dpnGbNQBq8AFPVNHXB4C543iq+dYiRFYtICCxO8xi2cpONVT54Jl6l9rGh3Vnidwj5IwkbsXkyiN96HfRb9XLh0rCBw4ydV6Y9+C+OmTAqlQwIKy50I/ykHyzggroeJSbgphiQwFR2EbHwAeSKdsdIB03ItnunHtf3F2LRIitDRGI1n4VUEYE1dYjrrjR791ao24Dp8J3Hg8IRb8E3vFTeYMWyOk4mh/zQGInfNBnRY2ruHH0JA&quot;
              }
          }
      ]
  };
     const response = await fetch('https://photoslibrary.googleapis.com/v1/mediaItems:batchCreate', {
          method: &quot;POST&quot;,
          headers: {
              &quot;Content-Type&quot;: &quot;application/json&quot;,
              &quot;Authorization&quot;: `Bearer ${accessToken}`
          },
          payload: JSON.stringify(payload)
      });
      const json = await response.json();
      console.log(json);
  </code></pre>
  <p>And getting this response:</p>
  <pre><code>{ error:
     { code: 400,
       message: 'Request must have at least one newMediaItem.',
       status: 'INVALID_ARGUMENT' } }
  </code></pre>
  <p>What could go wrong here?</p>
  <p>Any help is appreciated, thank you.</p>