title: How do you create a $batch Microsoft Graph API request using a PowerApps Custom Connector?
body: <p><strong>Overview:</strong></p>
  <p>I want to make a batch request in PowerApps using a Custom Connector to Graph API.</p>
  <p>In my PowerApp, I made a variable that contains valid JSON.</p>
  <p>I made a Custom Connector with an action that makes the batch request. In the Test tab, I can paste the JSON from my PowerApps variable into the body field and <strong>make a successful API request.</strong></p>
  <p>However, when I use that same JSON in PowerApps by passing it as a parameter into my Custom Connector Action, it returns an error: BadRequest, Invalid batch payload format.</p>
  <p><strong>More Details</strong></p>
  <p>I used the PowerApps Monitor to view the API request. Here is the body of that request (anonymized). I suspect the escaped quotes might be a problem</p>
  <pre><code>  &quot;body&quot;: &quot;{\&quot;requests\&quot;:[{\&quot;id\&quot;:\&quot;00ea5f2b-0000-0000-0000-7bf4ee2b0000\&quot;,\&quot;method\&quot;:\&quot;GET\&quot;,\&quot;url\&quot;:\&quot;/users/00ea5f2b-0000-0000-0000-7bf4ee2b0000\&quot;},{\&quot;id\&quot;:\&quot;00006977-0000-0000-0000-d17976e0000\&quot;,\&quot;method\&quot;:\&quot;GET\&quot;,\&quot;url\&quot;:\&quot;/users/00006977-4cbf-410e-0000-d17976e00000\&quot;}]}&quot;
  </code></pre>
  <p>The response to that request was</p>
  <pre><code>&quot;body&quot;: {
      &quot;error&quot;: {
        &quot;code&quot;: &quot;BadRequest&quot;,
        &quot;message&quot;: &quot;Invalid batch payload format.&quot;,
        &quot;innerError&quot;: {
          &quot;date&quot;: &quot;2022-01-14T23:51:48&quot;,
          &quot;request-id&quot;: &quot;00007cf4-76ad-467a-0000-0fd842980000&quot;,
          &quot;client-request-id&quot;: &quot;00007cf4-76ad-467a-0000-0fd842980000&quot;
  }}}
  </code></pre>
  <p>The Swagger code for my Custom Connector Action is:</p>
  <pre><code>  /v1.0/$batch:
      post:
        responses:
          default:
            description: default
            schema: {}
        summary: Batch Get Users
        description: Get a batch of users by sending an array of user ids to fetch.
        operationId: BatchGetUsers
        parameters:
        - name: body
          in: body
          required: true
          schema:
            type: string
            properties: {}
  </code></pre>
  <p>Useful Link: <a href="https://docs.microsoft.com/en-us/graph/json-batching?context=graph%2Fapi%2F1.0&amp;view=graph-rest-1.0" rel="nofollow noreferrer">Microsoft Graph API Batching Documentation</a></p>