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 => {
return res.json()
})
.then(res => {
this.movies.push(...res.data)
console.log(res.data)
})
.catch(err => 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.