Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Setting a Repository to Public or Private
Updated on 2026-01-27 GMT+08:00

Setting a Repository to Public or Private

Function

This API is used to set a repository to public or private.

URI

PUT /v2/repositories/{repository_uuid}/template-status

Table 1 Path parameter

Parameter

Mandatory

Type

Description

repository_uuid

Yes

String

Explanation:

Repository UUID. For details, see the UUID returned by Querying the Details About a Repository.

Constraints:

N/A

Range:

32 digits and letters.

Default value

N/A

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation:

User token. It can be obtained by calling the corresponding Obtaining a User Token. The value of X-Subject-Token in the response header is the user token.

Constraints:

N/A

Range:

1–100,000 characters.

Default value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

template_type

Yes

String

Explanation:

Template type.

Range:

  • SHARE: indicates a personal example template.
  • PUBLIC: indicates public read-only.

code_title

No

String

Explanation:

Code template name.

Range:

N/A

creator_name

No

String

Explanation:

Creator name.

Range:

N/A

code_description

No

String

Explanation:

Code template description.

Range:

N/A

languages

No

Array of strings

Explanation:

Template language.

Range:

N/A

plateform

No

Array of strings

Explanation:

Template platform.

Range:

N/A

entertype

No

Array of strings

Explanation:

Template tag.

Range:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Explanation:

Response error.

Range:

N/A

result

String

Explanation:

Response result.

Range:

N/A

status

String

Explanation:

Response status

Range:

  • success: The API call is successful.
  • failed: The API call failed.
Table 5 Error

Parameter

Type

Description

code

String

Explanation:

Error code.

Range:

Max. 100 characters in the error code format.

message

String

Explanation:

Error message.

Range:

N/A

Example Requests

PUT https://{endpoint}/v2/repositories/{repository_uuid}/template-status

{
	"template_type": "SHARE", 
	"code_title": "exampleTitle", 
	"creator_name": "exampleName", 
	"code_description": "exampleDescription", 
	"languages": ['Java'], 
	"plateform": ['Console'], 
	"entertype": ['AI']
}

Example Responses

Status code: 200

OK

{
  "result" : null,
  "error" : null,
  "status" : "success"
}

Status Code

Status Code

Description

200

OK

Error Codes

See Error Codes.