首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有多种方法不工作的环回rest连接器遥控器

具有多种方法不工作的环回rest连接器遥控器
EN

Stack Overflow用户
提问于 2021-02-18 21:38:25
回答 1查看 36关注 0票数 0

我使用Loopback4作为中央应用编程接口。我正在尝试通过Loopback中的远程方法调用第三方API的方法。我正在使用Strapi作为第三方应用程序接口,并将此信息传递给loopback4

使用Loopback,我有一个如下所示的数据源:

代码语言:javascript
复制
const strapiConfig = {
  name: 'strapi',
  connector: 'rest',
  baseURL: appConfig.strapi.host,
  crud: false,
  options: {
    headers: {
      "accept": "application/json",
      "content-type": "application/json",
      "cache-control": "no-cache",
      "Authorization" : `Bearer ${appConfig.strapi.token}`
    }
  },
  operations: [
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/pages/{pageId}`
      },
      "functions": {
        "getOnePage": ["pageId"]
      }
    },
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/pages`
      },
      "functions": {
        "getPages": ""
      }
    },
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/glossary/{id}`
      },
      "functions": {
        "getOneGlossary": ['id']
      }
    },
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/glossary`
      },
      "functions": {
        "getGlossary": ""
      }
    },
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/faq`
      },
      "functions": {
        "getFaqs": ""
      }
    },
    {
      "template": {
        "method": "GET",
        "url": `${strapiUrl}/faq/{id}`
      },
      "functions": {
        "getOneFaq": ['id']
      }
    }
  ]
};

唯一起作用的端点是页面

欢迎任何建议。谢谢!

EN

回答 1

Stack Overflow用户

发布于 2021-02-18 21:51:21

调用其他终结点时,您会得到哪种类型的错误/状态代码?

您是否在Strapi中设置了角色和权限?示例(取决于Strapi版本):

  1. 导航到设置-用户和权限插件。

  1. 单击公共角色。

  1. 在权限下向下滚动,打开应用程序选项卡,找到要编辑的集合类型。

find

  • ,即单击findfindone旁边的复选框。

  1. 单击保存

查看:https://strapi.io/documentation/developer-docs/latest/getting-started/quick-start.html#_7-set-roles-and-permissions

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66261112

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档