Solved

How can I get an entry including asset dimensions

  • 23 September 2022
  • 3 replies
  • 241 views

I’m using the /entry and /entries endpoints to fetch a data model which includes image assets. It seems that more or less everything about the asset is included, such as the url, the file name, type, size etc except for the dimensions. I came across this document which pointed me towards the include_dimensions=true query parameter when requesting assets directly with /assets, but after some digging through the documentation and trying the request myself it seems like it’s not possible to append this to any of the entry based requests.

I’ve also tried changing the model to accept images only as opposed to filtered file types but ultimately that does not change the response from the API.

Is there any way to get the information I need without having to make a separate API call just to get the dimensions? It feels like I should be able to control if this gets included when fetching any request that pulls child assets. Ultimately I’d like this information so I can make a number of informed decisions in my application regarding how my assets get displayed. 

Any help would be greatly appreciated! 

icon

Best answer by Sachin 23 September 2022, 16:18

View original

3 replies

Userlevel 3

Hi @Jives ,

The parameter needs to be include_dimension which will fetch the image dimensions if they are used inside an entry. Please refer the below link for your reference and try fetching an image’s dimension which is used inside an entry and let us know if it helps

https://www.contentstack.com/docs/developers/apis/content-delivery-api/#single-entry:~:text=a%20Single%20Asset-,include_dimension,-Get%20All%20Assets

Regards,

Sachin.

 

Hi @Jives ,

The parameter needs to be include_dimension which will fetch the image dimensions if they are used inside an entry. Please refer the below link for your reference and try fetching an image’s dimension which is used inside an entry and let us know if it helps

https://www.contentstack.com/docs/developers/apis/content-delivery-api/#single-entry:~:text=a%20Single%20Asset-,include_dimension,-Get%20All%20Assets

Regards,

Sachin.

 

Oh my… I need more coffee 😅

Thank you! Really happy this works. 

 

Userlevel 3

Awesome, happy to help :)

Reply