ListSearchSourceCode
Searches for code snippets based on filter conditions.
Try it now
Test
RAM authorization
Request syntax
POST /search/code HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The enterprise identifier, also known as the enterprise ID. It is a string and can be obtained from the Yunxiao access link, such as https://devops.aliyun.com/organization/[OrganizationId]. |
66c0c9fffeb86b450c199fcd |
| body |
object |
Yes |
The request body. |
|
| keyword |
string |
Yes |
The search keyword. |
test |
| page |
integer |
No |
The page number. Default value: 1. Pagination starts from page 1. |
1 |
| pageSize |
integer |
No |
The number of entries per page. Default value: 20. Valid values: 1 to 100. |
20 |
| sort |
string |
No |
The sort order. Default value: desc. Valid values:
|
desc |
| order |
string |
No |
The sort field. Default value: default. Valid values:
|
default |
| scope |
string |
No |
The search scope. Default value: all. Valid values:
|
all |
| repoPath |
object |
No |
The code repository query condition. |
|
| value |
string |
No |
The full path of the code repository, such as organization/group/repo. Note
If there are multiple code repository paths, separate them with commas (,). |
xxx |
| operatorType |
string |
No |
The query condition type. Valid values:
|
equal |
| matchType |
string |
No |
The query match type. Valid values:
|
term |
| filePath |
object |
No |
The code file path. Regular expressions are supported. |
|
| value |
string |
No |
The full path of the file, such as organization/group/repo/file. Note
If there are multiple full file paths, separate them with commas (,). |
orgId/test-group/spring-boot-demo/test.java |
| operatorType |
string |
No |
The query condition type. Valid values:
|
equal |
| matchType |
string |
No |
The query match type. Valid values:
|
term |
| language |
string |
No |
The programming language. |
Java |
| isCodeBlock |
boolean |
No |
Specifies whether to query code method block data, such as classes and methods. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
ASSDS-ASSASX-XSAXSA-XSAXSAXS |
| errorMessage |
string |
The error message. |
"" |
| errorCode |
string |
The error code. |
SYSTEM_UNKNOWN_ERROR |
| success |
boolean |
Indicates whether the call is successful. |
true |
| total |
integer |
The total number of records. |
2 |
| result |
array<object> |
The list of returned results. |
|
|
array<object> |
The returned results. |
||
| docId |
string |
The document ID. |
60d54f3daccf2bbd6659f3ad/gitlabhq/master/spec/frontend/snippets/test_utils.js |
| highlightTextMap |
object |
The highlighted text information. |
|
| organizationId |
string |
The highlighted enterprise ID. |
60de7a6852743a5162b5f957 |
| fileName |
string |
The matched file name. |
test.java |
| clob |
string |
The matched snippet in the file content. |
xxx |
| language |
string |
The programming language. |
java |
| source |
object |
The source information returned by Elasticsearch. |
|
| repoPath |
string |
The full path of the code repository, including the full group path. |
codeup/test-repo |
| fileName |
string |
The file name. |
test_utils.js |
| filePath |
string |
The file path. |
spec/frontend/snippets/test_utils.js |
| language |
string |
The programming language. |
JavaScript |
| checkinDate |
string |
The time of the most recent commit. |
2022-10-10 10:00:00 |
| branch |
string |
The branch name. |
master |
| organizationId |
string |
The enterprise identifier, also known as the enterprise ID. It is a string and can be obtained from the Yunxiao access link, such as https://devops.aliyun.com/organization/[OrganizationId]. |
60de7a6852743a5162b5f957 |
Examples
Success response
JSON format
{
"requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
"errorMessage": "\"\"",
"errorCode": "\t\nSYSTEM_UNKNOWN_ERROR",
"success": true,
"total": 2,
"result": [
{
"docId": "60d54f3daccf2bbd6659f3ad/gitlabhq/master/spec/frontend/snippets/test_utils.js",
"highlightTextMap": {
"organizationId": "60de7a6852743a5162b5f957",
"fileName": "test.java",
"clob": "xxx",
"language": "java"
},
"source": {
"repoPath": "codeup/test-repo",
"fileName": "test_utils.js",
"filePath": "spec/frontend/snippets/test_utils.js",
"language": "JavaScript",
"checkinDate": "2022-10-10 10:00:00",
"branch": "master",
"organizationId": "60de7a6852743a5162b5f957"
}
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.