Microsoft是否为Graph提供了一个swagger文件?

Pau*_*rke 10 swagger microsoft-graph

虽然我已经找到了尽可能多的文档,但我无法找到https://graph.microsoft.io/的招摇文件.

似乎有一对夫妇在这个API的变化,我已经看到了Office 365的图形API和Azure的图形API的参考,但我认为,微软图形是最新的统一版本,并提供我以后的功能.

我想使用Microsoft Flow,我很惊讶它没有集成为开箱即用的API.要使用Flow注册Custom API,您需要提供一个swagger文件,因此问题.

Cha*_*yen 5

我找到了一些可以在 OData XML 元数据和 swagger 之间进行转换的东西。https://github.com/akorchev/odata2openapi

Beta 版的 msgraph 元数据位于https://graph.microsoft.com/beta/$metadata

对于 TypeScript,你可以这样做:

import { odata2openapi } from 'odata2openapi';

odata2openapi('https://graph.microsoft.com/beta/$metadata')
.then(swagger => console.log(JSON.stringify(swagger, null, 2)))
.catch(error => console.error(error))
Run Code Online (Sandbox Code Playgroud)

更新:我注意到尝试时出现错误。我相信是因为当 EntityType 节点没有任何 Properties 节点时,代码无法处理。我提出了一个拉取请求来解决这个问题。https://github.com/akorchev/odata2openapi/pull/7