datocms / product-roadmap

This project is now discontinued. For feature requests, please use our community forum.
https://community.datocms.com/
19 stars 1 forks source link

Content Management API: Record data incomplete? #187

Closed james-relyea closed 5 years ago

james-relyea commented 5 years ago

Describe the bug When using the Content Management API to pull down items from /items, all of our image fields are returning a string instead of an asset object.

Example: thumbnailSmallUrl: '859676'

Without making a list of all the different image field names, we don't have a great way of knowing when the field is actually string or an asset ID. We're then having to make subsequent requests to the /uploads/:upload_id endpoint to retrieve the image URL from the attributes.

Expected behavior We expected to see the same properties structure that we see in the Webhook payloads:

"thumbnail_small_url": {
  "path": "/path/to/image.jpg",
  "format": "jpeg",
  "size": 123,
  "alt": null,
  "title": null,
  "width": 123,
  "height": 123
}
matjack1 commented 5 years ago

@james-relyea this is the intended behaviour, we return an upload ID that you can later use to retrieve the objects via the /uploads endpoint as you are saying.

If you want to get everything in one go you should consider using the GraphQL API? Not sure if it would be a viable option for you though.

james-relyea commented 5 years ago

@james-relyea this is the intended behaviour, we return an upload ID that you can later use to retrieve the objects via the /uploads endpoint as you are saying.

If you want to get everything in one go you should consider using the GraphQL API? Not sure if it would be a viable option for you though.

I'll switch over to use the GraphQL API instead. Thanks!