首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在OpenAPI中指定将用户添加到组中?

如何在OpenAPI中指定将用户添加到组中?
EN

Stack Overflow用户
提问于 2019-04-18 01:59:16
回答 1查看 321关注 0票数 0

我正在尝试为MS \Logic创建一个自定义连接器,它使用一些其他端点,这些端点是Microsoft图的一部分,但在理解如何在OpenAPI 2.0规范中记录API方面遇到了困难。

MS文档

https://learn.microsoft.com/en-us/graph/api/group-post-owners?view=graph-rest-1.0#example

说包括

代码语言:javascript
运行
复制
"@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"

作为请求主体的一部分的$ref参数

但是如何在OpenAPI 2.0规范中记录这一点呢?

这就是我目前所得到的.

代码语言:javascript
运行
复制
'/groups/{team-id}/owners':
    post:
      tags:
        - teams.team
      summary: Add a new owner to the team
      operationId: teams.AddOwner
      consumes:
        - application/json
      parameters:
        - name: team-id
          in: path
          required: true
          type: string
          description: Id of the MS team
          x-ms-summary: Team Id
          x-ms-visibility: important
        - name: body
          in: body
          required: true
          schema:
            type: object
            properties:
              userId:
                type: string
                description: Id of the user to be added as an owner to the team
                x-ms-summary: User Id
                x-ms-visibility: important
              '@odata.id':
                default: https://graph.microsoft.com/v1.0/users/{userId}
      responses:
        '204':
          description: Success
        default:
          $ref: '#/responses/error'
      x-ms-docs-operation-type: operation

当我提交上面的内容来创建自定义连接器时,我会得到以下错误

指定的文件不符合OpenAPI 2.0规范:“JSON2.0对”oneOf“中的任何模式都无效。路径'paths./groups/{team-id}/owners.post.parameters1'.‘

编辑

我已经更新了OpenAPI如下所示

这意味着我可以导入和使用这个..。但是,我必须在工作流中手动为@odata.id参数构造URL!

代码语言:javascript
运行
复制
"@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"
代码语言:javascript
运行
复制
'/groups/{team-id}/owners/$ref':
    post:
      tags:
        - teams.team
      summary: Add a new owner to the team
      operationId: teams.AddOwner
      consumes:
        - application/json
      parameters:
        - name: team-id
          in: path
          required: true
          type: string
          description: Id of the MS team
          x-ms-summary: Team Id
          x-ms-visibility: important
        - name: body
          in: body
          required: true
          schema:
            type: object
            properties:
              '@odata.id':
                title: User Id
                type: string
                x-ms-summary: User Id
                x-ms-visibility: important
      responses:
        '204':
          description: Success
        default:
          $ref: '#/responses/error'
      x-ms-docs-operation-type: operation

编辑

我应该如何指定这个以获得userId

如何正确地指定主体参数?

有没有关于如何做到这一点的文档\示例?

任何帮助都将不胜感激。

提前感谢

皮特

EN

回答 1

Stack Overflow用户

发布于 2019-05-09 03:35:08

我发现创建PowerApps自定义连接器的最简单方法之一是:

  1. 使用邮递员制作工作请求
  2. 从空白构建自定义连接器
  3. 自定义连接器“测试”区域中的测试

然后,如果需要,可以下载Swagger文件。基本上,让PowerApps为您构建Swagger文件,而不是反过来。

这是我喜欢使用的方法的YouTube视频。

https://m.youtube.com/watch?v=-wQljWG35zM

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

https://stackoverflow.com/questions/55738130

复制
相关文章

相似问题

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