Updated on 2024-10-16 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

Mandatory

Type

Description

project_id

Yes

String

Tenant's project ID. See Obtaining a Project ID.

application_id

Yes

String

Application ID. See Obtaining All Applications.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

limit

No

String

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

No

String

Offset.

order_by

No

String

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

Enumerated values: create_time, name, and update_time.

order

No

String

Sorting order.

  • desc (default)
  • asc

Request

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Default value: application/json;charset=utf8.

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain a token, see Obtaining a User Token.

Response

Table 4 Response parameters

Parameter

Type

Description

count

Integer

Total number of components.

components

Array of objects

Component parameters. See Table 5.

Table 5 components

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 system.

category

String

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

sub_category

String

Application component sub-category.

Webapp sub-categories include Web.

MicroService sub-categories include Java Chassis, and Spring Cloud.

Common sub-category can be empty.

application_id

String

Application ID.

source

Object

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

description

String

Description.

creator

String

Creator.

create_time

Integer

Creation time.

update_time

Integer

Update time.

project_id

String

Tenant's project ID.

build

Object

Build. See Table 10.

Table 6 source

Parameter

Type

Description

kind

String

Type. Option: source code or artifact software package.

spec

Object

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

Table 7 code spec

Parameter

Type

Description

repo_type

String

Code repository type. Value: GitHub, BitBucket, or GitLab.

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 8 artifact spec

Parameter

Type

Description

storage

String

Storage mode.

type

String

Type.

url

String

Address of the software package or source code.

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 9.

Table 9 artifact spec properties

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.

Table 10 build

Parameter

Type

Description

id

String

Job ID.

parameters

Map<String,String>

See Table 11.

Table 11 parameters

Parameter

Type

Description

build_cmd

String

Compilation command.

dockerfile_path

String

Address of the Docker file.

artifact_namespace

String

Build archive organization.

cluster_id

String

ID of the cluster to be built.

node_label_selector

Map<String, String>

key: label key. value: label value.

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
		}
	},
	"status": 0,
	"creator": "test_user",
	"create_time": 1610333934288,
	"update_time": 1610333934288
       }
    ], 
    "count": 1
}

Status Code

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

The error code format is SVCSTG.00100.[Error_ID], for example, SVCSTG.00100400. For details, see ServiceStage Error Codes.