gpt4 book ai didi

strapi api 不显示图像字段信息

转载 作者:行者123 更新时间:2023-12-05 02:30:29 43 4
gpt4 key购买 nike

我刚开始使用 strapi。

我创建了一个“事件”集合类型。

我的事件集合类型有以下字段(请注意图像字段)

  1. 姓名
  2. 鼻涕虫
  3. 地点
  4. 地址
  5. 日期
  6. 时间
  7. 表演者
  8. 描述
  9. 图片

当我访问 http://localhost:1337/api/events 时

我得到以下 json,它包含图像字段的信息。这是个问题。为什么image 的信息没有显示?如何使api返回的json中包含图片信息?

{"data":[{"id":1,"attributes":{"name":"Throwback Thursday with DJ Manny Duke","slug":"throwback-thursday-with-dj-manny-duke","venue":"Horizon Club","address":"919 3rd Ave New York, New York(NY), 1002","date":"2022-07-20T02:00:00.000Z","time":"10:00 PM","createdAt":"2022-04-12T02:05:08.246Z","updatedAt":"2022-04-12T02:17:16.760Z","publishedAt":"2022-04-12T02:05:16.192Z","performers":"DJ Manny Duke","description":"Description for the vent of DJ Manny Duke"}},{"id":2,"attributes":{"name":"Boom Dance Festival Experience","slug":"boom-dance-festival-experience","venue":"Blackjacks","address":"123 Lexington","date":"2022-04-25T16:00:00.000Z","time":"8:00 PM","createdAt":"2022-04-12T02:26:32.123Z","updatedAt":"2022-04-12T02:26:33.540Z","publishedAt":"2022-04-12T02:26:33.538Z","performers":"DJ LUKE, DJ BLACKJACK","description":"Whatever Description"}},{"id":3,"attributes":{"name":"Encore Night Boat Party","slug":"encore-night-boat-party","venue":"Encore","address":"12343 New York","date":"2022-11-14T16:00:00.000Z","time":"7:00 PM","createdAt":"2022-04-12T02:28:06.028Z","updatedAt":"2022-04-12T02:28:36.292Z","publishedAt":"2022-04-12T02:28:07.622Z","performers":"BAD BOY BILL","description":"Description of Encore"}}],"meta":{"pagination":{"page":1,"pageSize":25,"pageCount":1,"total":3}}}

最佳答案

如果不填充,图像数据将不会显示。你需要使用这样的东西 http://localhost:1337/api/events?populate=yourImage

yourImage 替换为您在 strapi 中用于图像的属性名称

关于strapi api 不显示图像字段信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71836399/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com