创建术语Create term

命名空间:microsoft.graph.termStoreNamespace: microsoft.graph.termStore

重要

Microsoft Graph /beta 中的版本下的 API 可能会更改。APIs under the /beta version in Microsoft Graph are subject to change. 不支持在生产应用程序中使用这些 API。Use of these APIs in production applications is not supported. 若要确定 API 在 v1.0 中是否可用,请使用版本 选择 器。To determine whether an API is available in v1.0, use the Version selector.

创建新的 术语对象Create a new term object.

权限Permissions

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最低特权到最高特权)Permissions (from least to most privileged)
委派(工作或学校帐户)Delegated (work or school account) TermStore.ReadWrite.AllTermStore.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application 不支持。Not supported.

HTTP 请求HTTP request

POST /termStore/sets/{setId}/children
POST /termStore/sets/{setId}/terms/{termId}/children

请求标头Request headers

名称Name 说明Description
AuthorizationAuthorization Bearer {token}。必需。Bearer {token}. Required.
Content-TypeContent-Type application/json. Required.application/json. Required.

请求正文Request body

在请求正文中,提供术语对象的 JSON 表示 形式。In the request body, supply a JSON representation of the term object.

下表显示创建术语时所需的 属性The following table shows the properties that are required when you create the term.

属性Property 类型Type DescriptionDescription
labelslabels microsoft.graph.termStore.localizedLabel 集合microsoft.graph.termStore.localizedLabel collection 要创建的术语的标签Label for the term to be created

响应Response

如果成功,此方法在响应 201 Created 正文中返回响应代码和术语对象。If successful, this method returns a 201 Created response code and a term object in the response body.

示例Examples

请求Request

POST https://graph.microsoft.com/beta/termStore/sets/{setId}/terms
Content-Type: application/json
Content-length: 366

{
  "labels": [
    {
      "languageTag" : "en-US",
      "name" : "Car",
      "isDefault" : true
    }
  ]
}

响应Response

注意: 为了提高可读性,可能缩短了此处显示的响应对象。Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-Type: application/json

{
  "createdDateTime": "2019-06-21T20:01:37Z",
  "id": "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f",
  "labels" : [
      {
          "name" : "Car",
          "languageTag" : "en-US",
          "isDefault" : true
      }
  ],
  "lastModifiedDateTime": "2019-06-21T20:01:37Z"
}