Updated on 2024-04-23 GMT+08:00

Querying a List of Services

Function

This API is used to query details about all services.

Only the platinum edition supports service-related functions.

URI

GET /v2/{project_id}/edgemgr/services?{name=xxx,limit=xxx,offset=xxx}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

limit

No

Long

Number of records on each page during pagination query. The maximum value is 100, and the default value is 10.

offset

No

Long

Query offset. The default value is 0.

sorted

No

String

Whether the queried services are sorted based on the specified field.

name

No

String

Service name.

app

No

String

Application based on which services are queried.

Request

Table 3 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response

When the status code is 200, the response parameters are as follows:

Table 4 Parameters in the response body

Parameter

Type

Description

count

Long

Number of endpoints that meet the conditions.

services

Array of ServiceRespDetail objects

Service list.

Table 5 ServiceRespDetail

Parameter

Type

Description

created_at

String

Creation time.

id

String

Service ID.

meta_data

SvcMetadata object

Static properties of the service.

project_id

String

Tenant ID.

spec

SvcSpec object

Dynamic properties of the service.

updated_at

String

Update time.

Table 6 SvcMetadata

Parameter

Type

Description

labels

Map<String,String>

List of customized labels.

name

String

Service name. The name contains a maximum of 64 characters starting with a letter and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed.

Table 7 SvcSpec

Parameter

Type

Description

cluster_ip

String

Virtual service IP address.

external_ips

Array of strings

List of external IP addresses. This parameter is not supported currently.

external_name

String

External domain name. This parameter is not supported currently.

ports

Array of SvcPort objects

List of service ports to be exposed.

selector

Map<String,String>

Label selector, which is used to select the pods with the specified labels for management.

type

String

Service type.

Table 8 SvcPort

Parameter

Type

Description

name

String

The service port must be named in the {protocol}-{suffix} format, where {protocol} can be tcp or http. IEF provides routing capabilities based on protocols defined on ports. For example, name:http-0 and name:tcp-0 are valid port names, while name:http2forecast is invalid.

node_port

String

Port number mapped to the physical machine when spec.type is set to NodePort.

port

String

Port on which the service listens.

protocol

String

Protocol, for example, TCP.

target_port

String

Port number of the backend pod to which requests are forwarded.

When the status code is 500, the response parameters are as follows:

Table 9 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

Example Request

None

Example Response

None

Status Codes

Status Code

Description

200

Query succeeded.

500

Error response.

Error Codes

For details, see Error Codes.