QueryCostCenterResource

Updated at:
Copy as MD

Queries the resource instances associated with a financial unit. If CostCenterId is set to 0, the operation queries unassigned parent and child resource instances.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

bss:DescribeCostUnit

none

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

OwnerAccountId

integer

No

The ID of the owner account for the financial unit.

1234567812345678

CostCenterId

integer

No

The ID of the financial unit.

123456

NextToken

string

No

The token for the next query. An empty value indicates that no more results are available.

CAESEgoQCg4KCmd

MaxResults

integer

No

The maximum number of records to return in a single query.

200

EcIdAccountIds

array<object>

No

The list of enterprises and accounts. If this parameter is empty, the current account is queried.

object

No

The list of enterprises and accounts.

AccountIds

array

No

The list of accounts to access. If this parameter is empty, all accounts under the current entity ID are selected.

integer

No

The ID of the member accounts.

1501603440974415

EcId

string

Yes

The ID of the enterprise entity.

1501603440974415

Nbid

string

No

The ID of the primary marketplace. If this parameter is empty, the marketplace ID of the current user is used by default.

2684201000001

Response elements

Element

Type

Description

Example

object

BssApiTokenResult

CostCenterResourceDtoList

array<object>

The data list.

object

The detailed data.

AddStrategy

string

The allocation strategy.

AUTO_ALLOCATE

AddStrategyName

string

The added policy name.

Automatic allocation

ApplicablePeriodNum

integer

The number of refreshed billing cycles.

3

ApportionItemCode

string

The code of the attached resource.

test

ApportionItemName

string

The name of the attached resource.

test

CommodityCode

string

The commodity code of the resource.

otsbag

CommodityName

string

The commodity name of the resource.

ApsaraDB

CostCenterCode

string

The code of the cost center.

code

CostCenterCreateTime

string

The creation time of the cost center. The format is YYYY-MM-DD HH:mm:ss.

2025-05-18 12:12:25

CostCenterId

integer

The ID of the cost center.

123456

CostCenterName

string

The name of the cost center.

test

CostCenterUpdateTime

string

The last update time of the cost center. The format is YYYY-MM-DD HH:mm:ss.

2025-05-18 16:12:25

FinanceUnitRuleVersion

integer

The version of the rule.

3

InstanceId

string

The ID of the billing granularity.

cn-hangzhou;standard

MasterCommodityCode

string

The code of the associated commodity.

ecs

MasterInstanceId

string

The associated instance ID.

i-xxxxx

OwnerAccountId

integer

The ID of the customer to which the cost center belongs.

1234567812345678

OwnerAccountName

string

The name of the customer to which the cost center belongs.

Customer A

ParentCostCenterId

integer

The ID of the parent cost center.

123456

PipCode

string

The product code, which is the same as the product code in the User Center bill.

rds

PipName

string

The name of the product.

ApsaraDB

RecentBillingMonth

integer

The latest billing cycle.

202509

RegionName

string

The name of the region.

Shanghai

RegionNo

string

The region.

cn-shanghai

ResourceGroup

string

The resource group to which the resource belongs.

Default resource group

ResourceId

string

The ID of the resource.

OSSBAG-cn-v0h1s4hma018

ResourceNick

string

The custom nickname of the resource.

testResource

ResourceSource

string

The source of the resource. Valid values:

  • AUTO_ALLOCATE: Automatic allocation.

  • MANUAL_ALLOCATE: Manual allocation.

MANUAL_ALLOCATE

ResourceTag

string

The tag of the resource.

tag

ResourceType

string

The type of the resource.

FPT_ossbag_absolute_Storage_bj

ResourceUpdateTime

string

The last update time of the cost center. This is a reserved field and is currently unavailable. The format is YYYY-MM-DD HH:mm:ss.

2025-05-18 16:12:25

ResourceUserId

integer

The ID of the user that owns the resource.

1234567812345678

ResourceUserName

string

The name of the user that owns the resource.

test@test.aliyun.com

RootCostCenterId

integer

The ID of the root cost center.

-1

StartBillingMonth

integer

The billing cycle when the rule takes effect.

202509

MaxResults

integer

The maximum number of records to return in a single query.

200

Metadata

any

The metadata of the response structure.

{}

NextToken

string

The token for the next query. An empty value indicates that no more results are available.

eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9

RequestId

string

The ID of the request.

79EE7556-0CFD-44EB-9CD6-B3B526E3A85F

TotalCount

integer

The total number of records.

2000

Examples

Success response

JSON format

{
  "CostCenterResourceDtoList": [
    {
      "AddStrategy": "AUTO_ALLOCATE",
      "AddStrategyName": "automatic allocation",
      "ApplicablePeriodNum": 3,
      "ApportionItemCode": "test",
      "ApportionItemName": "test",
      "CommodityCode": "otsbag",
      "CommodityName": "ApsaraDB",
      "CostCenterCode": "code",
      "CostCenterCreateTime": "2025-05-18 12:12:25",
      "CostCenterId": 123456,
      "CostCenterName": "test",
      "CostCenterUpdateTime": "2025-05-18 16:12:25",
      "FinanceUnitRuleVersion": 3,
      "InstanceId": "cn-hangzhou;standard",
      "MasterCommodityCode": "ecs",
      "MasterInstanceId": "i-xxxxx",
      "OwnerAccountId": 1234567812345678,
      "OwnerAccountName": "CustomerA",
      "ParentCostCenterId": 123456,
      "PipCode": "rds",
      "PipName": "ApsaraDB",
      "RecentBillingMonth": 202509,
      "RegionName": "Shanghai",
      "RegionNo": "cn-shanghai",
      "ResourceGroup": "Default resource group",
      "ResourceId": "OSSBAG-cn-v0h1s4hma018\n",
      "ResourceNick": "testResource",
      "ResourceSource": "MANUAL_ALLOCATE",
      "ResourceTag": "tag",
      "ResourceType": "FPT_ossbag_absolute_Storage_bj",
      "ResourceUpdateTime": "2025-05-18 16:12:25\n",
      "ResourceUserId": 1234567812345678,
      "ResourceUserName": "test@test.aliyun.com\n",
      "RootCostCenterId": -1,
      "StartBillingMonth": 202509
    }
  ],
  "MaxResults": 200,
  "Metadata": "{}",
  "NextToken": "eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9",
  "RequestId": "79EE7556-0CFD-44EB-9CD6-B3B526E3A85F",
  "TotalCount": 2000
}

Error codes

HTTP status code

Error code

Error message

Description

400 CostCenter.MasterAndSubHasNoRelation Your account has no valid account relation yet.
400 CostCenter.ResourceAuthFailed The instance does not belong to the current user.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.