【问题标题】:How to fetch data form a retaliton?如何从报复中获取数据?
【发布时间】:2020-08-28 00:43:32
【问题描述】:

我用构建器创建了两个内容类型,分别是categoriarestaurants我需要从中获取这些数据关系 例如,如果 categoria 名称是 tacos,则 restaurant 的所有详细信息。

我需要我的 API 与 postman 一起工作。

【问题讨论】:

  • 你需要 REST API 吗?

标签: node.js swagger postman endpoint strapi


【解决方案1】:

如果你会使用 GraphQL,那就很简单了。

Postman 支持 GraphQL。 Check its docs.

query restaurants {
  restaurants {
    id
    name
    categoria {
      id
      name
    }
  }
}

您也可以通过 REST API 使用复杂的查询。

https://strapi.io/documentation/v3.x/content-api/parameters.html#deep-filtering

例如:

/restaurants?_where[0][stars]=1&_where[1][pricing_lte]=20

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多