Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Microsoft provide a swagger file for Graph?

I've crawled though as much documentation as I can find but I'm unable to find a swagger file for https://graph.microsoft.io/

There appear to be a couple of variations on this API and I've seen references to the Office 365 Graph API and Azure Graph API but I believe that Microsoft Graph is that latest unified version and provides the features I'm after.

I'd like to use the with Microsoft Flow and I was surprised that it wasn't integrated as an API out of the box. To register a Custom API with Flow however you need to provide a swagger file, hence the question.

like image 533
Paul Clarke Avatar asked Nov 02 '16 07:11

Paul Clarke


People also ask

What Microsoft application is used for graphs?

Graph Explorer is a web-based tool that you can use to build and test requests using Microsoft Graph APIs. You can access Graph Explorer at: https://developer.microsoft.com/graph/graph-explorer.

Is Microsoft Graph API deprecated?

Azure Active Directory (Azure AD) Graph is deprecated and will be retired at any time after June 30, 2023, without advance notice, as we announced in September, 2022.

Is the Microsoft Graph API free?

We have some datasets available for free or are currently free in preview while other datasets are charged. Microsoft Graph Data Connect offers datasets across multiple different Microsoft 365 products and services.


1 Answers

I found something to convert between OData XML metadata to swagger. https://github.com/akorchev/odata2openapi

The msgraph metadata for beta is at https://graph.microsoft.com/beta/$metadata.

For TypeScript, you would do something like this:

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))

UPDATE: I noticed there was an error when trying it. I believe because the code did not handle when EntityType node did not have any Properties nodes. I put in a pull request to fix that. https://github.com/akorchev/odata2openapi/pull/7

like image 53
Chau Nguyen Avatar answered Oct 11 '22 13:10

Chau Nguyen