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

Querying Your Subscriptions

Function

This API is used to query your subscriptions to cloud and dedicated WAF instances billed on a yearly/monthly or pay-per-use basis.

URI

GET /v1/{project_id}/waf/subscription

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. To obtain the value, go to the Cloud management console first. Then, click your username, select My Credentials, and view the Project ID column in the Projects area.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Content-Type

Yes

String

Content type.

Default: application/json;charset=utf8

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

type

Integer

The edition for the cloud WAF instance.

  • -2: Frozen.

  • -1: Not subscribed.

  • 2: The Standard edition.

  • 3: The Professional edition.

  • 4: The Platinum edition.

  • 7: The Starter edition.

  • 22: The pay-per-use edition.

resources

Array of ResourceResponse objects

The resource list.

isNewUser

Boolean

New user or not.

premium

Premium object

Information about subscriptions to dedicated WAF instances

Table 4 ResourceResponse

Parameter

Type

Description

resourceId

String

Resource ID.

cloudServiceType

String

Cloud service type

resourceType

Object

Cloud service resource type.

  • hws.resource.type.waf: yearly/monthly cloud-mode WAF

  • hws.resource.type.waf.domain: domain name expansion packages in yearly/monthly cloud-mode WAF

  • hws.resource.type.waf.bandwidth: bandwidth expansion packages in yearly/monthly cloud-mode WAF

  • hws.resource.type.waf.rule: rule expansion packages in yearly/monthly cloud-mode WAF

  • hws.resource.type.waf.payperuserequest: requests to pay-per-use WAF instances

  • hws.resource.type.waf.payperusedomain: domain names protected with pay-per-use WAF instances

  • hws.resource.type.waf.payperuserule: rules created in pay-per-use WAF instances

resourceSpecCode

String

Cloud resource specifications.

status

Integer

Resource status. The value can be:

  • 0: Unfrozen/Normal.

  • 1: Frozen.

  • 2: Deleted.

expireTime

String

Resource expiration time.

resourceSize

Integer

Resource quantity.

Table 5 Premium

Parameter

Type

Description

purchased

Boolean

Whether the dedicated mode is enabled.

total

Integer

The number of dedicated WAF instances, including load-balancing instances.

elb

Integer

The number of load-balancing WAF instances (ELB mode).

dedicated

Integer

The number of the dedicated WAF instances

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

The following example shows how to query the subscriptions in a project. The project ID is specified by project_id.

GET https://{Endpoint}/v1/{project_id}/waf/subscription?

Example Responses

Status code: 200

Request succeeded.

{
  "type" : 3,
  "resources" : [ {
    "resourceId" : "d2759a06ed844b9c9837bb76326ca656",
    "cloudServiceType" : "hws.service.type.waf",
    "resourceType" : "hws.resource.type.waf",
    "resourceSpecCode" : "waf.enterprise",
    "resourceSize" : null,
    "expireTime" : "2022-12-07T15:59:59Z",
    "status" : 0
  }, {
    "resourceId" : "6a5a4b06dbcd4cc5be6ff88bcd988046",
    "cloudServiceType" : "hws.service.type.waf",
    "resourceType" : "hws.resource.type.waf.rule",
    "resourceSpecCode" : "waf.expack.rule.enterprise",
    "resourceSize" : 5,
    "expireTime" : "2022-12-07T15:59:59Z",
    "status" : 0
  }, {
    "resourceId" : "a9202ca8704740b6a1e0481c80bd4255",
    "cloudServiceType" : "hws.service.type.waf",
    "resourceType" : "hws.resource.type.waf.domain",
    "resourceSpecCode" : "waf.expack.domain.enterprise",
    "resourceSize" : 10,
    "expireTime" : "2022-12-07T15:59:59Z",
    "status" : 0
  } ],
  "isNewUser" : false,
  "premium" : {
    "purchased" : true,
    "total" : 8,
    "elb" : 0,
    "dedicated" : 8
  }
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.