文档

GetSearchCodePreview - 查询预览代码片段

根据文档ID和关键字获取到预览代码片段。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求语法

GET /search/code_preview

请求参数

名称类型必填描述示例值
organizationIdstring

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

627475075b46541dd2ff01bc
docIdstring

文档 ID

60d54f3daccf2bbd6659f3ad/gitlabhq/master/config/environments/test.rb
keywordstring

搜索关键字

test
isDslboolean

是否是 DSL 搜索

false

返回参数

名称类型描述示例值
object

Schema of Response

requestIdstring

请求 ID

A7586FEB-E48D-5579-983F-74981FBFF627
errorCodestring

错误码

SYSTEM_UNKNOWN_ERROR
errorMessagestring

错误信息

""
successboolean

调用是否成功

true
resultobject

ES 的搜索结果

docIdstring

文档 ID

xxx
highlightTextMapobject

高亮文本信息

organizationIdstring

云效企业 ID

5ffd468b1e45db3c1cc26ad6
fileNamestring

高亮文件名

test.rb
clobstring

命中的文件内容中的某个片段

xxx
sourceobject

ES 返回的源信息

repoPathstring

代码库完整路径(含完整组路径)

codeup/test-repo
fileNamestring

文件名称

test.rb
filePathstring

文件完整路径

config/environments/test.rb
languagestring

编程语言

Ruby
checkinDatestring

最近一次 commit 时间

2022-12-12 12:12:12
branchstring

分支名称

master
organizationIdstring

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

5f9f9f6122a8c7ff3934f99a

示例

正常返回示例

JSON格式

{
  "requestId": "A7586FEB-E48D-5579-983F-74981FBFF627",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "errorMessage": "\"\"",
  "success": true,
  "result": {
    "docId": "xxx",
    "highlightTextMap": {
      "organizationId": "5ffd468b1e45db3c1cc26ad6",
      "fileName": "test.rb",
      "clob": "xxx"
    },
    "source": {
      "repoPath": "codeup/test-repo",
      "fileName": "test.rb",
      "filePath": "config/environments/test.rb",
      "language": "Ruby",
      "checkinDate": "2022-12-12 12:12:12",
      "branch": "master",
      "organizationId": "5f9f9f6122a8c7ff3934f99a"
    }
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (0)
文档反馈