Updated on 2025-12-05 GMT+08:00

Creating a Maven Repository

Function

This API is used to create a Maven repository.

Calling Method

For details, see Calling APIs.

URI

POST /cloudartifact/v5/maven/repositories

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

repository_name

Yes

String

Definition

Repository name.

Constraints

String length: 1–50 characters.

Range

N/A.

Default value

None

format

Yes

String

Definition

Package type.

Constraints

N/A.

Range

maven2

Default value

None

description

No

String

Definition

Repository description.

Constraints

Maximum length: 200 characters.

Range

N/A.

Default value

None

release

No

String

Definition

Release repository name.

Constraints

String length: 1–50 characters.

Range

N/A.

Default value

None

snapshot

No

String

Definition

Snapshot repository name.

Constraints

String length: 1–50 characters.

Range

N/A.

Default value

None

includes_pattern

No

String

Definition

Include Patterns.

Constraints

Maximum length: 512 characters.

Range

N/A.

Default value

None

share_right

No

String

Definition

Shared permissions.

Constraints

N/A.

Range

PROJECT

Default value

None

project_id

No

String

Definition

Project ID, which can be obtained by calling an API or from the console. For details about how to obtain the project ID, see Obtaining a Project ID (CloudArtifact_api_0015.xml).

Constraints

The value contains 32 characters. Only letters and digits are supported.

Range

N/A.

Default value

None

type

Yes

String

Definition

Repository type.

Constraints

N/A.

Range

hosted: local repository

Default value

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

status

String

Definition

Request status.

Range

success: The request is successful.

error: The request fails.

trace_id

String

Definition

Request ID, which uniquely identifies the current request.

Range

A string of digits and hyphens (-).

result

CreateMavenRepoResult object

Definition

Information about the created Maven repository.

Range

N/A.

Table 3 CreateMavenRepoResult

Parameter

Type

Description

release

String

Definition

ID of the release repository.

Range

N/A.

snapshot

String

Definition

ID of the snapshot repository.

Range

N/A.

Example Requests

This API is used to create a Maven repository.

https://artifact.example.myhuaweicloud.com/cloudartifact/v5/maven/repositories

{
  "repository_name" : "testmaven",
  "format" : "maven2",
  "description" : "",
  "release" : "testmaven",
  "snapshot" : "testmaven",
  "includes_pattern" : "**/*",
  "share_right" : "PROJECT",
  "project_id" : "e2ee90487d6349dd944a5767225f6f55",
  "type" : "hosted"
}

Example Responses

Status code: 200

OK

{
  "status" : "success",
  "trace_id" : "143002-1701175135227-77",
  "result" : {
    "release" : "xx-xxxxx-x_5a775fdcb14f4431b6c0015618140bc3_maven_1_201",
    "snapshot" : "xx-xxxxx-x_5a775fdcb14f4431b6c0015618140bc3_maven_2_201"
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.