title: API Platform custom resource with custom request body
body: <p>I'm pretty new to Symfony and API Platform. I'm trying to create a custom resource/operation which receives the body of the request, fetches data from the database according to the values and then returns a collection of the entity back to the client.</p>
  <p>Example:
  A <code>GET</code> request with the following body:</p>
  <pre><code>{
     &quot;trackName&quot;: &quot;example&quot;
     &quot;anotherKey&quot;: &quot;anotherValue&quot;
  }
  </code></pre>
  <p>According to these attributes I would like to query data, do calculations and then return the data.</p>
  <p>I'm trying to figure out how to make this the API Platform way. I've been googling and looking for it in the documentation for hours, but I can't find a way to achieve this.</p>
  <p>I've tried to query data with a <code>CollectionDataProvider</code> and with a controller like this:</p>
  <pre><code>/**
   * @ApiResource(
   *     itemOperations={
   *          &quot;tracks_custom_endpoint&quot;={
   *              &quot;method&quot;=&quot;GET&quot;,
   *              &quot;path&quot;=&quot;/tracks/custom_endpoint&quot;,
   *              &quot;controller&quot;=MyController::class,
   *              &quot;read&quot;=false
   *          }
   *     }
   * )
   * @ORM\Entity(repositoryClass=SpotifyTrackRepository::class)
   */
  class Track
  {
     // Attributes, setters and getters
  }
  </code></pre>
  <p>However, either way I can't access the body of the request respectively the JSON data which has been sent with it. Is there a way I can access this data somehow and then process it.</p>