Create书签

命名空间:microsoft.graph.search

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

Create新的书签对象。

此 API 可用于以下国家级云部署

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) SearchConfiguration.Read.All SearchConfiguration.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 SearchConfiguration.Read.All SearchConfiguration.ReadWrite.All

HTTP 请求

POST /search/bookmarks

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权
Content-Type application/json. 必需。

请求正文

在请求正文中,提供 书签 对象的 JSON 表示形式。

下表显示了创建 书签时可用的属性。

属性 类型 说明
availabilityEndDateTime DateTimeOffset 书签停止显示为搜索结果的日期和时间。 null设置为 始终可用。 时间戳类型使用 ISO 8601 格式表示日期和时间信息,并且始终采用 UTC 格式。 例如,2014 年 1 月 1 日午夜 UTC 为 2014-01-01T00:00:00Z
availabilityStartDateTime DateTimeOffset 书签开始显示为搜索结果的日期和时间。 null设置为 始终可用。 时间戳类型使用 ISO 8601 格式表示日期和时间信息,并且始终采用 UTC 格式。 例如,2014 年 1 月 1 日午夜 UTC 为 2014-01-01T00:00:00Z
类别 String 集合 通常用于描述此书签的类别。 例如, ITHR
说明 String 搜索结果页上显示的书签说明。 继承自 searchAnswer
displayName String 搜索结果中显示的书签名称。 继承自 searchAnswer
groupIds String collection 能够查看此书签的安全组列表。
keywords microsoft.graph.search.answerKeyword 触发此书签显示在搜索结果中的关键字。
languageTags 字符串集合 可在其中查看此书签的地理特定语言名称的列表。 每个语言标记值都遵循 {language}-{region} 模式。 例如, en-us 是美国中使用的英语。 有关可能值的列表,请参阅 支持的语言标记
平台 microsoft.graph.devicePlatformType 集合 能够查看此书签的设备和操作系统列表。 可能的值是:androidandroidForWorkiosmacOSwindowsPhone81windowsPhone81AndLaterwindows10AndLaterandroidWorkProfileunknownandroidASOPandroidMobileApplicationManagementiOSMobileApplicationManagementunknownFutureValue
powerAppIds 字符串集合 与此书签关联的 Power Apps 列表。 如果用户将现有 Power Apps 添加到书签,他们可以直接在搜索结果页上完成任务,例如输入休假时间或报告费用。
state microsoft.graph.search.answerState 书签的状态。 可能的值是:publisheddraftexcludedunknownFutureValue
targetedVariations microsoft.graph.search.answerVariant 集合 不同国家/地区或设备的书签变体。 需要根据用户设备、国家/地区或两者向用户显示不同内容时使用。 日期和组设置适用于所有变体。
webUrl String 书签的 URL 链接。 当用户从搜索结果中选择此书签时,会定向到指定的 URL。 继承自 searchAnswer

响应

如果成功,此方法返回响应 201 Created 代码,其中包含创建的书签的 ID。

示例

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/beta/search/bookmarks
Content-Type: application/json

{
  "displayName": "Contoso Install Site",
  "webUrl": "http://www.contoso.com/",
  "description": "Try or buy Contoso for Home or Business and view product information",
  "keywords":  {
    "keywords": ["Contoso", "install"],
    "reservedKeywords": ["Unique keyword"],
    "matchSimilarKeywords": true
  },
  "availabilityStartDateTime": null,
  "availabilityEndDateTime": null,
  "platforms": ["windows"],
  "targetedVariations": [
    {
      "languageTag": "es-es",
      "displayName": "Sitio de instalación Contoso",
      "description": "Pruebe o compre Contoso hogar o negocios y vea la información del producto"
    }
  ],
  "state": "published"
}

响应

以下示例显示了相应的响应。

HTTP/1.1 201 Created
Location: /733b26d5-af76-4eea-ac69-1a0ce8716897
Content-Type: application/json

{
  "id": "733b26d5-af76-4eea-ac69-1a0ce8716897"
}