Updated on 2023-06-25 GMT+08:00

Obtaining All Components of an Application

Function

This API is used to obtain all components of an application.

URI

GET /v2/{project_id}/cas/applications/{application_id}/components

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Tenant's project ID.

application_id

String

Yes

Application ID.

Table 2 Query parameters

Parameter

Type

Mandatory

Description

limit

String

No

Number of records to be displayed. The value is 1000 or ranges from 0 to 100. If the specified value is not within the range, value 10 is assigned. In the non-pagination scenario, the value is 1000. In the pagination scenario, the value ranges from 0 to 100.

offset

String

No

Offset.

order_by

String

No

Sorting field. By default, query results are sorted by creation time.

The following enumerated values are supported: create_time, name, and update_time.

order

String

No

Descending or ascending order. Default value: desc.

Request

None

Response

Table 3 Response parameters

Parameter

Type

Description

count

Integer

Total number of components.

components

Array of objects

Component parameters. See Table 4.

Table 4 components parameters

Parameter

Type

Description

id

String

Application component ID.

name

String

Application component name.

status

Integer

Value: 0 or 1.

0: Normal.

1: Being deleted.

runtime

String

Runtime.

category

String

Application component type. Example: Webapp, MicroService, or Common.

sub_category

String

Application component sub-type.

Webapp sub-types include Web.

MicroService sub-types include Java Chassis, Go Chassis, Mesher, Spring Cloud, and Dubbo.

Common sub-type can be empty.

application_id

String

Application ID.

source

Object

Source of the code or software package. See Table 5.

description

String

Description.

creator

String

Creator.

create_time

Integer

Creation time.

update_time

Integer

Update time.

Table 5 source parameters

Parameter

Type

Description

kind

String

Type. Option: source code or artifact software package.

spec

Object

For details about the source code, see Table 6. For details about the artifact software package, see Table 7.

Table 6 code spec parameters

Parameter

Type

Description

repo_type

String

Code repository. Value: GitHub, GitLab, Gitee, or Bitbucket.

repo_url

String

Code repository URL. Example: https://github.com/example/demo.git.

repo_ref

String

Code branch or tag. Default value: master.

repo_auth

String

Authorization name, which can be obtained from the authorization list.

Table 7 artifact spec parameters

Parameter

Type

Description

storage

String

Storage mode.

type

String

Type.

url

String

Software package address.

auth

String

Authentication mode.

properties

Object

Other attributes of the software package. You need to add these attributes only when you set storage to obs. See Table 8.

Table 8 artifact spec properties parameters

Parameter

Type

Description

endpoint

String

OBS endpoint address. Example: https://obs.region_name.external_domain_name.com.

bucket

String

Name of the OBS bucket where the software package is stored.

key

String

Object in the OBS bucket, which is usually the name of the software package. If there is a folder, the path of the folder must be added. Example: test.jar or demo/test.jar.

Example

Example request

None

Example response
{
    "components": [
       {
	"id": "384eb8d4-c193-4d84-9558-6fda2366b536",
	"name": "mycomponent",
	"runtime": "Java8",
	"category": "MicroService",
	"sub_category": "Java Chassis",
	"description": "",
	"project_id": "384eb8d4-c193-4d84-9558-6fda23698536",
	"application_id": "a8f7eed5-0aa0-4251-9723-c9119a6bf56d",
        "source": {
		"kind": "artifact",
		"spec": {
			"storage": "obs",
			"type": "package",
			"url": "obs://myapp/demo.jar",
			"properties": {
				"bucket": "myapp",
				"key": "demo.jar",
				"endpoint": "https://obs.region_id.external_domain_name.com"
			}
		}
	},
	"build": {
		"id": "w3dpv7p0t1vpxvey5hjb22iuwxway1vupwx0nae1",
		"parameters": {
			"artifact_namespace": "ns",
			"use_public_cluster": true
		}
	},
	"pipeline_ids": null,
	"status": 0,
	"creator": "xxx",
	"create_time": 1610333934288,
	"update_time": 1610333934288
       }
    ], 
    "count": 1
}

Status Code

Table 9 Status codes

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

Error code must be in the format of SVCSTG.00100.[Error_ID]. Example: SVCSTG.00100400. See Error Codes of Application Management APIs.