Querying the Service Group Member List

Function

This API is used to query the service group member list.

URI

GET /v1/{project_id}/service-items

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

set_id

Yes

String

Service group ID, which can be obtained by calling the API for querying the service group list. Find the value in data.records.set_id (The period [.] is used to separate different levels of objects).

key_word

No

String

Query field, which can be a service group member name or a part of the service group member description.

limit

Yes

Integer

Number of records displayed on each page. The value ranges from 1 to 1024.

offset

Yes

Integer

Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.

enterprise_project_id

No

String

Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to Obtaining an Enterprise Project ID. If the enterprise project function is not enabled, the value is 0.

fw_instance_id

No

String

Firewall ID, which can be obtained by referring to Obtaining a Firewall ID.

query_service_set_type

No

Integer

Type of the service group to be queried: 0 (user-defined service group), 1 (predefined service group). This parameter is valid only if set_id is the ID of a predefined service group.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. You can obtain the token by referring to Obtaining a User Token.

Content-Type

Yes

String

Content type. It can only be set to application/json.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

data

data object

Service group member list.

Table 5 data

Parameter

Type

Description

offset

Integer

Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.

limit

Integer

Number of records displayed on each page. The value ranges from 1 to 1024.

total

Integer

Total number of service group members.

set_id

String

Service group ID.

records

Array of records objects

Record.

Table 6 records

Parameter

Type

Description

item_id

String

Service member ID.

protocol

Integer

Protocol type: 6 (TCP), 17 (UDP), 1 (ICMP), 58 (ICMPv6), or -1 (any). It cannot be left blank when type is set to 0 (manual), and can be left blank when type is set to 1 (automatic).

source_port

String

Source port.

dest_port

String

Destination port.

description

String

Service member description.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

-

String

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

-

String

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

-

String

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

-

String

Example Requests

Query the members of service group 7cdebed3-af07-494e-a3c2-b88bb8d58b57 in project 9d80d070b6d44942af73c9c3d38e0429.

https://{Endpoint}/v1/9d80d070b6d44942af73c9c3d38e0429/service-items?set_id=7cdebed3-af07-494e-a3c2-b88bb8d58b57&limit=10&offset=0

Example Responses

Status code: 200

Return value of the service group member list.

{
  "data" : {
    "limit" : 10,
    "offset" : 0,
    "records" : [ {
      "dest_port" : "0",
      "item_id" : "805b711d-c558-41e3-aab1-a4b8c3f1f90b",
      "description" : "",
      "protocol" : 1,
      "source_port" : "0"
    } ],
    "set_id" : "7cdebed3-af07-494e-a3c2-b88bb8d58b57",
    "total" : 1
  }
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00200005",
  "error_msg" : "Object not found."
}

Status Codes

Status Code

Description

200

Return value of the service group member list.

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.