在 Microsoft Graph 中使用教育 APIWorking with education APIs in Microsoft Graph

Microsoft Graph 中的教育 API 可增强 Office 365 资源和与教育情景(包括学校、学生、教师、课程和注册)相关的信息的数据。The education APIs in Microsoft Graph enhance Office 365 resources and data with information that is relevant for education scenarios, including schools, students, teachers, classes, and enrollments. 这使你能够轻松地构建与教育资源集成的解决方案。This makes it easy for you to build solutions that integrate with educational resources.

教育 API 包含名册资源和作业资源,可以使用这些资源与 Microsoft Teams 中的名册服务进行交互。The education APIs include rostering resources and assignments resources that you can use to interact with the rostering services in Microsoft Teams. 可以使用这些资源来管理学校名册。You can use these resources to manage a school roster.

授权Authorization

若要在 Microsoft Graph 中调用教育 API,你的应用需要获取访问令牌。To call the education APIs in Microsoft Graph, your app will need to acquire an access token. 有关访问令牌的详细信息,请参阅获取用于调用 Microsoft Graph 的访问令牌For details about access tokens, see Get access tokens to call Microsoft Graph. 你的应用还需要具有相应的权限。Your app will also need the appropriate permissions. 有关详细信息,请参阅教育权限For more information, see Education permissions.

若要部署与 Microsoft Graph 中的教育 API 集成的应用,学校 IT 管理员必须首先授权许可应用请求的权限。To deploy apps that are integrated with the Education APIs in Microsoft Graph, school IT admins must first grant consent to the permissions requested by the app. 仅能授权许可一次,除非权限更改。This consent has to be granted only once, unless the permissions change. 在管理员许可后,就会为租户中的所有用户预配应用。After the admin consents, the app is provisioned for all users in the tenant.

若要显示许可对话框,请执行以下 REST 调用。To show a consent dialog box, use the following REST call.

GET https://login.microsoftonline.com/{tenant}/adminconsent?
client_id={clientId}&state=12345&redirect_uri={redirectUrl}
参数Parameter 说明Description
TenantTenant 学校的租户 ID。Tenant ID of the school. 使用完整 ID,其中包含 onmicrosoft.com。Use the full ID, which includes onmicrosoft.com.
clientIdclientId 应用的客户端 ID。Client ID of the app.
redirectUrlredirectUrl 应用重定向 URL。App redirect URL.

RosteringRostering

借助名册 API,可以从学校的 Office 365 租户(预配了 Microsoft 学校数据同步)中提取数据。这些 API 提供对有关学校、部门、教师、学生和名册的信息的访问权限。The rostering APIs enable you to extract data from a school's Office 365 tenant provisioned with Microsoft School Data Sync. These APIs provide access to information about schools, sections, teachers, students, and rosters. API 既支持仅应用(同步)方案,也支持应用 + 用户(交互)方案。The APIs support both app-only (sync) scenarios, and app + user (interactive) scenarios. 支持交互式方案的 API 基于调用 API 的用户角色,强制实施相应地区的 RBAC 策略。The APIs that support interactive scenarios enforce region-appropriate RBAC policies based on the user role calling the API. 这可以提供一致的 API 和最小策略展现,而无需考虑租户中的管理配置。This provides a consistent API and minimal policy surface, regardless of the administrative configuration within tenants. 此外,API 还提供特定于教育的权限,确保相应用户具有访问数据的权限。In addition, the APIs also provide education-specific permissions to ensure that the right user has access to the data.

可以使用名册 API 让应用用户了解:You can use the rostering APIs to enable an app user to know:

  • 我是谁Who I am
  • 我参加或教学的课程What classes I attend or teach
  • 我需要做什么以及完成时间What I need to do and by when

名册 API 提供以下关键资源:The rostering APIs provide the following key resources:

名册 API 支持以下方案:The rostering APIs support the following scenarios:

后续步骤Next steps

使用 Microsoft Graph 教育 API 构建访问学校名册的教育解决方案。Use the Microsoft Graph education APIs to build education solutions that access school rosters. 了解详细信息:To learn more:

  • 探索对你的方案最有帮助的资源和方法。Explore the resources and methods that are most helpful to your scenario.
  • 尝试在 Graph 浏览器中使用 API。Try the API in the Graph Explorer.