How do I get the image path inside a jsonapi response? I a content type for movies that includes plain text fields, and an image. The field name for the image is field_movie_poster.
Using the JSON API, How do I include the image path in the request?
If I put this Postman I get the correct response:
https://drupal-api.ddev.site/jsonapi/node/movies?include=image_field

But the same does not work with JavaScript
getMovies() {
    fetch('https://drupal-api.ddev.site/jsonapi/node/movies',{
        include: 'image_field'
    })
    .then(res =&gt; {
        return res.json()
    })
    .then(res =&gt; {
        
        this.movies.push(...res.data)
        console.log(res.data)

    })
    .catch(err =&gt; console.log(err))
}

How do I include the image path in the request?
If you look at the image attached, you will see that field_movie_poster is under the relationships attribute, and it does not include the image path.
For entity reference/images fields you have to include them to have their &quot;full&quot; data:
https://drupal-api.ddev.site/jsonapi/node/movies?include=image_field

The response will contain an object called included where you'll find that data,
Details for a image field:
{
  &quot;type&quot;: &quot;file--file&quot;,
  &quot;id&quot;: &quot;cc6ef625-8549-49c3-bc1c-0ef41551d8f7&quot;,
  &quot;links&quot;: {
    &quot;describedby&quot;: {
      &quot;href&quot;: &quot;drupal-api.ddev.site/jsonapi/file/file/resource/schema&quot;
    },
    &quot;self&quot;: {
      &quot;href&quot;: &quot;drupal-api.ddev.site/jsonapi/file/file/cc6ef625-8549-49c3-bc1c-0ef41551d8f7&quot;
    }
  },
  &quot;attributes&quot;: {
    &quot;drupal_internal__fid&quot;: 29282,
    &quot;langcode&quot;: &quot;it&quot;,
    &quot;filename&quot;: &quot;1920x1080.jpg&quot;,
    &quot;uri&quot;: {
      &quot;value&quot;: &quot;public://images/articles/2021-04/1920x1080.jpg&quot;,
      &quot;url&quot;: &quot;/sites/default/files/images/articles/2021-04/1920x1080.jpg&quot;
    },
    &quot;filemime&quot;: &quot;image/jpeg&quot;,
    &quot;filesize&quot;: 40767,
    &quot;status&quot;: true,
    &quot;created&quot;: &quot;2021-04-13T10:22:44+00:00&quot;,
    &quot;changed&quot;: &quot;2021-04-13T10:22:52+00:00&quot;
  },
  &quot;relationships&quot;: {
    &quot;uid&quot;: {
      &quot;data&quot;: {
        &quot;type&quot;: &quot;user--user&quot;,
        &quot;id&quot;: &quot;c178495f-8a4c-410c-8e83-ebac79bc2162&quot;
      },
      &quot;links&quot;: {
        &quot;related&quot;: {
          &quot;href&quot;: &quot;drupal-api.ddev.site/jsonapi/file/file/cc6ef625-8549-49c3-bc1c-0ef41551d8f7/uid&quot;
        },
        &quot;self&quot;: {
          &quot;href&quot;: &quot;drupal-api.ddev.site/jsonapi/file/file/cc6ef625-8549-49c3-bc1c-0ef41551d8f7/relationships/uid&quot;
        }
      }
    }
  }
}

Please note you'll have to cross-check the id of that file with the id value of the image_field to get the correct file\url for each different image.