Help Center/ SecMaster/ API Reference/ SecMaster APIs (V1)/ Metering and Billing/ Querying Subscribed Resources of a User
Updated on 2026-02-05 GMT+08:00

Querying Subscribed Resources of a User

Function

This API is used to query details about a subscribed resource. Note that the purchase, usage, and smn parameters are mutually exclusive. Only one request parameter can be matched at a time. The priority is as follows: smn > usage > purchase.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/subscriptions/orders

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

SMN subscription offset.

limit

No

Integer

Number of SMN subscriptions.

page

No

String

Resource details in an order. DEFAULT: default value. It returns the list of enabled resources, excluding the package. PURCHASE: returns the number of ECSs under the tenant name based on what is returned by DEFAULT. RESOURCE_LIST: returns the package list based on what is returned by DEFAULT. USAGE: returns resource usage information. SMN: returns the list of subscribed SMN topics.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. You can call the IAM API to obtain a user token. The value of X-Subject-Token in the response header is the user token.

X-Language

Yes

String

Current language.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

csb_version

String

The service edition in use. The value can be BASIC (basic edition), STANDARD (standard edition), PROFESSIONAL (professional edition), or NA (no edition). The value is case-insensitive.

ecs_count

Integer

Number of ECSs. This value is returned only when the request parameter purchase is set to true. Otherwise, the value is 0.

resources

Array of SubscriptionResource objects

Resource list.

subscription_count

Integer

Number of topic subscriptions. This field is returned when the request parameter smn is set to true.

subscriptions

Array of SmnSubscription objects

User subscription information. If the request parameter smn is set to true, the list of SMN topics that can be subscribed to by the user is returned.

Table 5 SubscriptionResource

Parameter

Type

Description

resource_id

String

Resource ID.

resource_type_name

String

Resource name.

resource_size

Integer

Resource specifications.

cloud_service

String

Order source. The default value is SecMaster.

resource_type

String

Resource type.

resource_spec_code

String

Resource specification code.

to_period

Boolean

Whether the billing mode for the current resource can be changed from pay-per-use to yearly/monthly.

create_time

Long

Creation timestamp.

update_time

Long

Update timestamp.

expire_time

Long

Expiration timestamp. This field is available only for pay-per-use resources.

resource_status

Integer

Resource status. Currently, only resources that are running properly are returned, and the status value is 0.

order_id

String

Order ID. This field is available only for yearly/monthly resources.

charging_mode

String

Billing mode. Currently, the options are yearly/monthly (PREPAID) and pay-per-use (POSTPAID). The value is case-insensitive.

tag_list

Array of SubscriptionTagInfo objects

Resource list.

usages

Array of ResourceUsage objects

Resource usage. This field is returned when usage is set to true.

Table 6 SubscriptionTagInfo

Parameter

Type

Description

key

String

Key.

A maximum of 36 characters are allowed. Only letters, digits, hyphens (-), and underscores (_) are allowed.

value

String

Value. A tag value is a string of up to 43 characters and can contain letters (A-Z and a-z), digits (0-9), periods (.), hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF). It can be an empty string.

create_time

Long

Creation timestamp.

update_time

Long

Update timestamp.

Table 7 ResourceUsage

Parameter

Type

Description

unit

String

Usage unit. The options are OPS, ** MB**, and GB.

resource_type_name

String

Resource type name.

source_resource_spec_code

String

Source resource specification code.

resource_spec_code

String

Source resource specification code.

source_type

String

Source resource type code.

used_percent

Double

Usage percentage.

quota

Double

Total quota.

used

Double

Used quota.

free

Double

Available quota.

Table 8 SmnSubscription

Parameter

Type

Description

owner

String

Tenant project ID.

endpoint

String

Subscription endpoint.

protocol

String

Endpoint protocol, for example, HTTPS, SMS, EMAIL, and HTTP.

subscription_urn

String

Subscription URN.

topic_urn

String

URN of the subscription topic.

status

Integer

Subscription status.

0: unconfirmed

1: confirmed

2: confirmation not required

3: confirmation canceled

4: deleted

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

  • Query the tenant resource list.

    GET https://{endpoint}/v1/{projectId}/subscriptions/orders
  • Query the tenant resource list with the number of ECSs.

    GET https://{endpoint}/v1/{projectId}/subscriptions/orders?purchase=true
  • Query the tenant resource usage list.

    GET https://{endpoint}/v1/{projectId}/subscriptions/orders?usage=true

Example Responses

Status code: 200

Response to the request for querying historical subscription information.

{
  "csb_version" : "PROFESSIONAL",
  "ecs_count" : 12,
  "resources" : [ {
    "resource_id" : "c9528aa2-d593-11f0-a34e-fa163e798915",
    "resource_type" : "xxx.resource.type.secmaster.typical",
    "resource_spec_code" : "csb.professional",
    "resource_type_name" : "SecMaster Professional",
    "resource_size" : 2,
    "resource_status" : 0,
    "order_id" : "CS2510212051NLDL4",
    "cloud_service" : "SecMaster,",
    "charging_mode" : "PREPAID",
    "to_period" : false,
    "create_time" : 1765349400000,
    "update_time" : 1765349400000,
    "expire_time" : 1796885400000,
    "tag_list" : [ {
      "key" : "dept",
      "value" : "dev",
      "create_time" : 1765349400000,
      "update_time" : 1765349400000
    } ],
    "usages" : [ {
      "resource_type_name" : "SecMaster Professional-Security Orchestration",
      "source_resource_spec_code" : "csb.professional",
      "resource_spec_code" : "soar.action",
      "source_type" : "xxx.resource.type.csb.professional",
      "unit" : "OPS",
      "quota" : 100,
      "used_percent" : 0.2,
      "used" : 20,
      "free" : 80
    } ]
  } ],
  "subscription_count" : 1,
  "subscriptions" : [ {
    "owner" : "7bae9770eb3a47d3ba4759a88e4b748d",
    "endpoint" : "maizhelun@xxx.com",
    "protocol" : "email",
    "subscription_urn" : "urn:smn:demo-region:7bae9770eb3a47d3ba4759a88e4b748d:test-topic-abc:d4b4f367adf9420abc03736391069934",
    "topic_urn" : "urn:smn:demo-region:7bae9770eb3a47d3ba4759a88e4b748d:test-topic-abc",
    "status" : 1
  } ]
}

Status Codes

Status Code

Description

200

Response to the request for querying historical subscription information.

403

Insufficient permissions.

Error Codes

See Error Codes.