All Products
Search
Document Center

Platform For AI:GetCodeSource

Last Updated:Apr 23, 2025

Obtains the details of a code source.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
paicodesource:GetCodeSourceget
*All Resources
*
    none
none

Request syntax

GET /api/v1/codesources/{CodeSourceId} HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
CodeSourceIdstringYes

The ID of the code source. You can call ListCodeSources to query the code source ID.

code-202**********

Response parameters

ParameterTypeDescriptionExample
object

The returned body.

CodeSourceIdstring

The ID of the code source.

code-202**********
DisplayNamestring

The name of the code source.

MyCodeSource1
Descriptionstring

The description of the code source.

This is my data source 1.
CodeRepostring

The address of the code repository.

https://code.aliyun.com/pai-dlc/examples.git
CodeBranchstring

The code repository branch.

master
CodeCommitstring

The code commit ID.

44da10***********
CodeRepoUserNamestring

The username of the code repository.

user1
CodeRepoAccessTokenstring

The token used to access the code repository.

xxxx
MountPathstring

The local mount path of the code.

/root/code
Accessibilitystring

The visibility of the code source. Valid values:

  • PRIVATE: Visible only to you and the administrator of the workspace.
  • PUBLIC: Visible to all members in the workspace.
PRIVATE
UserIdstring

The ID of the creator.

1722********
WorkspaceIdstring

The workspace ID.

1234
GmtCreateTimestring

The time when the code source was created, in the ISO8601 format.

2021-01-12T23:36:01.123Z
GmtModifyTimestring

The time when the code source was modified, in the ISO8601 format.

2021-01-12T23:36:01.123Z
RequestIdstring

The request ID.

5A14FA81-DD4E-******-6343FE44B941

Examples

Sample success responses

JSONformat

{
  "CodeSourceId": "code-202**********",
  "DisplayName": "MyCodeSource1",
  "Description": "This is my data source 1.",
  "CodeRepo": "https://code.aliyun.com/pai-dlc/examples.git",
  "CodeBranch": "master",
  "CodeCommit": "44da10***********",
  "CodeRepoUserName": "user1",
  "CodeRepoAccessToken": "xxxx",
  "MountPath": "/root/code",
  "Accessibility": "PRIVATE",
  "UserId": "1722********",
  "WorkspaceId": "1234",
  "GmtCreateTime": "2021-01-12T23:36:01.123Z",
  "GmtModifyTime": "2021-01-12T23:36:01.123Z",
  "RequestId": "5A14FA81-DD4E-******-6343FE44B941"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history