Microsoft Graph APIMicrosoft Graph API

Microsoft Graph API 是一种 RESTful Web API,可用于访问 Microsoft 云服务资源。The Microsoft Graph API is a RESTful web API that enables you to access Microsoft Cloud service resources. 注册应用并获取用户或服务的身份验证令牌后,可以向 Microsoft Graph API 发出请求。After you register your app and get authentication tokens for a user or service, you can make requests to the Microsoft Graph API. 有关详细信息,请参阅 Microsoft Graph 概述For more information, see Overview of Microsoft Graph.

Microsoft Graph 公开 REST API 和客户端库以访问以下 Microsoft 365 服务上的数据:Microsoft Graph exposes REST APIs and client libraries to access data on the following Microsoft 365 services:

  • Microsoft 365 服务:Delve、Excel、Microsoft Bookings、Microsoft Teams、OneDrive、OneNote、Outlook/Exchange、Planner 和 SharePointMicrosoft 365 services: Delve, Excel, Microsoft Bookings, Microsoft Teams, OneDrive, OneNote, Outlook/Exchange, Planner, and SharePoint
  • 企业移动性和安全性服务:高级威胁分析、高级威胁防护、Azure Active Directory、Identity Manager 和 IntuneEnterprise Mobility and Security services: Advanced Threat Analytics, Advanced Threat Protection, Azure Active Directory, Identity Manager, and Intune
  • Windows 10 服务:活动、设备、通知Windows 10 services: activities, devices, notifications
  • Dynamics 365 Business CentralDynamics 365 Business Central

版本Versions

Microsoft Graph 当前支持两个版本:v1.0 和 beta 版本。Microsoft Graph currently supports two versions: v1.0 and beta. v1.0 版本包含了正式版 API。The v1.0 version includes generally available APIs. 对所有生产应用使用 v1.0 版本。Use the v1.0 version for all production apps. beta 版本包含当前为预览版的 API。The beta includes APIs that are currently in preview. 由于我们可能对 beta API 进行重大更改,因此建议你仅使用 beta 版本测试正在开发的应用;请勿在生产应用中使用 beta API。Because we might introduce breaking changes to our beta APIs, we recommend that you use the beta version only to test apps that are in development; do not use beta APIs in your production apps. 有关详细信息,请参阅 Microsoft Graph 的版本控制、支持和重大更改策略For more information, see Versioning, support, and breaking change policies for Microsoft Graph.

若要开始使用 beta API,请参阅 Microsoft Graph beta 终结点参考To start using the beta APIs, see Microsoft Graph beta endpoint reference

若要开始使用 v1.0 API,请参阅 Microsoft Graph REST API v1.0 参考To start using the v1.0 APIs, see Microsoft Graph REST API v1.0 reference

入门Get started

若要读取或写入资源(例如用户或电子邮件),请构造如下所示的请求:To read from or write to a resource such as a user or an email message, you construct a request that looks like the following:

{HTTP method} https://microsoftgraph.chinacloudapi.cn/{version}/{resource}?{query-parameters}

有关构造的请求的元素的详细信息,请参阅使用 Microsoft Graph APIFor more information about the elements of the constructed request, see Use the Microsoft Graph API

可使用快速入门示例了解如何访问 Microsoft Graph API 的强大功能。Quickstart samples are available to show you how to access the power of the Microsoft Graph API. 可用样本通过一种身份验证访问两个服务:Microsoft 帐户和 Outlook。The samples that are available access two services with one authentication: Microsoft account and Outlook. 每个快速入门都访问 Microsoft 帐户用户的配置文件中的信息,并显示其日历中的事件。Each quickstart accesses information from Microsoft account users' profiles and displays events from their calendar. 快速入门包括四个步骤:The quickstarts involve four steps:

  • 选择平台Select your platform
  • 获取应用 ID(客户端 ID)Get your app ID (client ID)
  • 生成示例Build the sample
  • 登录并查看日历上的事件Sign in, and view events on your calendar

完成快速入门后,你便有了一个可随时运行的应用。When you complete the quickstart, you have an app that's ready to run. 有关详细信息,请参阅 Microsoft Graph 快速入门常见问题解答For more information, see the Microsoft Graph quickstart FAQ. 若要开始学习这些示例,请参阅 Microsoft Graph 快速入门To get started with the samples, see Microsoft Graph QuickStart.

工具Tools

Microsoft Graph 浏览器是一种基于 Web 的工具,可用于通过 Microsoft Graph API 生成和测试请求。Microsoft Graph Explorer is a web-based tool that you can use to build and test requests using Microsoft Graph APIs. 可在以下位置访问 Microsoft Graph 浏览器:https://developer.microsoft.com/zh-cn/graph/graph-explorer-chinaYou can access Microsoft Graph Explorer at: https://developer.microsoft.com/zh-cn/graph/graph-explorer-china.

Postman 是一种可用于通过 Microsoft Graph API 生成和测试请求的工具。Postman is a tool that you can also use to build and test requests using the Microsoft Graph APIs. 可在以下位置下载 Postman:https://www.getpostman.com/You can download Postman at: https://www.getpostman.com/. 要与 Postman 中的 Microsoft Graph 进行交互,请使用 Postman 中的 Microsoft Graph 集合。To interact with Microsoft Graph in Postman, you use the Microsoft Graph collection in Postman. 有关详细信息,请参阅将 Postman 与 Microsoft Graph API 配合使用For more information, see Use Postman with the Microsoft Graph API.