# 按指定组获取商品列表

从指定组获取商品列表以构建商品目录。


  注意
    所有项目对响应中可获取的商品数量均有限制。默认值和最大值均为每个响应50个商品。如需按页获取更多数据，请使用limit和offset字段。





  注：
    未经授权使用此API调用时，会返回通用商品目录数据。如需获取
    个性化
    用户数据，例如与商品相关的数量限制和促销活动，请使用授权。为此，请在Authorization请求头中传递用户JWT。
    有关用户JWT的更多信息，请参阅此调用的Security部分。

Endpoint: GET /v2/project/{project_id}/items/virtual_items/group/{external_id}
Version: 2.0.0
Security: XsollaLoginUserJWT

## Path parameters:

  - `project_id` (integer, required)
    项目ID。您可以在发布商帐户的项目名称旁找到此参数；使用项目时，也可以在浏览器地址栏中找到此参数。URL格式如下：https://publisher.xsolla.com//projects/。
    Example: 44056

  - `external_id` (string, required)
    创建商品组时指定的外部商品组ID。
    Example: "weapons"

## Query parameters:

  - `limit` (integer)
    页面上元素数量的限制。
    Example: 50

  - `offset` (integer)
    生成列表时作为起始位置的元素编号（从0开始计数）。

  - `locale` (string)
    响应语言。符合ISO 639-1标准的两位小写语言代码（例如en）。name和description等本地化字段支持五字符区域代码（例如en-US），但在响应中会标准化为两位代码。支持的语言完整列表请参阅文档。

  - `additional_fields[]` (array)
    响应中需额外返回的字段。默认不返回这些字段。如需返回，请传入对应的字段值。
    Enum: "media_list", "order", "long_description", "custom_attributes", "item_order_in_group"

  - `country` (string)
    符合ISO 3166-1 alpha-2标准的两位大写国家/地区代码。关于艾克索拉支持的国家/地区和国家/地区判定流程的详细信息，请参阅文档。
    Example: "US"

  - `promo_code` (string)
    区分大小写的唯一兑换码。包含字母和数字。
    Example: "WINTER2021"

  - `show_inactive_time_limited_items` (integer)
    显示对用户不可用的时效性商品。这类商品的有效期尚未开始或已经结束。
    Example: 1

## Response 200 fields (application/json):

  - `has_more` (boolean)
    用作指示还有更多页面。

  - `items` (array)
    Example: [{"sku":"com.xsolla.big_rocket_1","name":"Big Rocket","groups":[{"external_id":"weapons","name":"weapons"}],"attributes":[{"external_id":"stack_size","name":"Stack size","values":[{"value":"5"}]}],"type":"virtual_good","description":"Big Rocket - description","image_url":"https://popmedia.blob.core.windows.net/popyourself/male/outfit/male_armor_white_a-01.png","is_free":false,"price":{"amount":"100.99","amount_without_discount":"100.99","currency":"USD"},"virtual_prices":[{"amount":100,"sku":"com.xsolla.vc_1","is_default":true,"amount_without_discount":100,"image_url":"http://image.png","name":"SHOTGUN FOR TRUE RAIDERS","type":"virtual_currency","description":"description"}],"can_be_bought":true,"virtual_item_type":"non_renewing_subscription","promotions":[{"name":"Bonus promotion","date_start":"2020-04-15T16:16:00+03:00","date_end":"2026-04-15T16:16:00+03:00","discount":{"percent":"50.00"},"bonus":[{"quantity":1,"name":"Xsolla Minigun","image_url":"https://cdn.xsolla.net/img/misc/images/2fc5c491a47413a8e8000447889093c2.png","sku":"com.xsolla.minigun_1","type":"virtual_good"}]}],"limits":{"per_user":{"total":5,"available":3,"recurrent_schedule":{"interval_type":"weekly","reset_next_date":1746057600},"limit_exceeded_visibility":"show"},"per_item":null},"periods":[{"date_from":"2020-08-11T10:00:00+03:00","date_until":"2020-08-11T20:00:00+03:00"}]},{"sku":"com.xsolla.shotgun_raider","name":"SHOTGUN FOR TRUE RAIDERS","groups":[{"external_id":"weapons","name":{"en":"weapons"}}],"attributes":[{"external_id":"stack_size","name":"Stack size","values":[{"value":"5"}]},{"external_id":"rating","name":"Rating","values":[{"value":"3.9"}]},{"external_id":"genre","name":"Genre","values":[{"value":"Strategy"},{"value":"Tactical"},"Turn-based"]}],"type":"virtual_good","description":"description","image_url":"http://image.png","is_free":false,"price":{"amount":"101.0","amount_without_discount":"101.0","currency":"USD"},"virtual_prices":[{"amount":100,"sku":"com.xsolla.vc_1","is_default":true,"amount_without_discount":100,"image_url":"http://image.png","name":"SHOTGUN FOR TRUE RAIDERS","type":"virtual_currency","description":"description"},{"amount":200,"sku":"com.xsolla.vc_2","is_default":false,"amount_without_discount":200,"image_url":"http://image.png","name":"SHOTGUN FOR TRUE RAIDERS","type":"virtual_currency","description":"description"}],"can_be_bought":true,"virtual_item_type":"non_renewing_subscription","promotions":[],"limits":null,"periods":[]}]

  - `items.sku` (string)
    唯一商品ID。SKU只能包含大小写英文字母、数字、句点、短横线和下划线。
    Example: "com.xsolla.big_rocket_1"

  - `items.name` (string)
    商品名称。
    Example: "Big Rocket"

  - `items.groups` (array)
    商品所属分组。

  - `items.groups.external_id` (string)
    创建商品组时指定的[外部商品组ID](/zh/api/catalog/item-groups-admin/admin-create-item-group#item-groups-admin/admin-create-item-group/t=request&path=external_id)。
    Example: "exclusive"

  - `items.groups.name` (string)
    组名称。
    Example: "Exclusive"

  - `items.groups.item_order_in_group` (integer)
    商品在组内的位置，用于决定其显示顺序。
仅在通过additional_fields[]查询参数请求时返回。
    Example: 1

  - `items.attributes` (array)
    与商品对应的属性及其值的列表。可用于商品目录筛选。

  - `items.attributes.external_id` (string)
    唯一属性ID。 external_id只能包含大小写英文字母、数字、短横线和下划线。

  - `items.attributes.name` (object)
    属性名称。
    Example: "Genre"

  - `items.attributes.values` (array)

  - `items.attributes.values.external_id` (string)
    属性的唯一值ID。 external_id只能包含小写英文字母、数字、短横线和下划线。

  - `items.attributes.values.value` (string)
    属性值。
    Example: "Strategy"

  - `items.type` (string)
    商品类型：consumable/expiration/permanent/lootboxes/physical。
    Example: "virtual_good"

  - `items.description` (string)
    商品描述。
    Example: "Big Rocket - description"

  - `items.image_url` (string)
    图片URL。
    Example: "https://popmedia.blob.core.windows.net/popyourself/male/outfit/male_armor_white_a-01.png"

  - `items.is_free` (boolean)
    该商品是否免费。

  - `items.price` (object)
    商品价格。

  - `items.price.amount` (string)
    商品折后价格。
    Example: "100.99"

  - `items.price.amount_without_discount` (string)
    商品价格。
    Example: "100.99"

  - `items.price.currency` (string)
    商品价格币种。符合[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)标准的三字母代码。
    Example: "USD"

  - `items.virtual_prices` (array)
    虚拟价格。

  - `items.virtual_prices.amount` (integer)
    以虚拟货币表示的商品价格。
    Example: 100

  - `items.virtual_prices.amount_without_discount` (integer)
    商品折扣前的虚拟货币价格。由于折扣不适用于虚拟货币价格，因此该值始终等于amount。
    Example: 200

  - `items.virtual_prices.sku` (string)
    虚拟货币SKU。
    Example: "vc_gold"

  - `items.virtual_prices.is_default` (boolean)
    是否为默认虚拟货币价格。
    Example: true

  - `items.virtual_prices.image_url` (string,null)
    虚拟货币图片URL。
    Example: "http://image.png"

  - `items.virtual_prices.name` (string)
    虚拟货币名称。
    Example: "Gold"

  - `items.virtual_prices.type` (string)
    商品类型。对于虚拟货币，该值为virtual_currency。
    Example: "virtual_currency"

  - `items.virtual_prices.description` (string,null)
    虚拟货币说明。
    Example: "In-game currency used to purchase weapons and upgrades"

  - `items.can_be_bought` (boolean)
    如为true，则用户可以购买商品。

  - `items.virtual_item_type` (string)
    虚拟物品的类型。

可能值：
- consumable — 使用后会从物品库中消失的商品（例如弹药）。
- non_consumable — 可无限期保留在物品库中的商品。
- non_renewing_subscription — 时效性商品，可表示在限定时间内对服务或内容的访问权限。"
    Enum: "consumable", "non_consumable", "non_renewing_subscription"

  - `items.promotions` (array)
    应用于购物车中指定商品的促销活动。仅在以下情况下返回该数组：

* 为某商品配置了折扣促销活动。

* 应用了具有对所选商品提供折扣设置的兑换码。

如果未应用任何商品级促销活动，则返回空数组。

  - `items.promotions.name` (string)

  - `items.promotions.date_start` (string,null)

  - `items.promotions.date_end` (string,null)

  - `items.promotions.discount` (object,null)

  - `items.promotions.discount.percent` (string,null)

  - `items.promotions.discount.value` (string,null)

  - `items.promotions.bonus` (array)

  - `items.promotions.bonus.sku` (string)

  - `items.promotions.bonus.quantity` (integer)

  - `items.promotions.bonus.type` (string)
    赠品类型。
    Enum: "virtual_good", "virtual_currency", "bundle", "physical_good", "game_key", "nft"

  - `items.promotions.bonus.name` (string)
    赠品名称。不适用于physical_good赠品类型。

  - `items.promotions.bonus.image_url` (string)
    赠品图片URL。不适用于physical_good赠品类型。

  - `items.promotions.bonus.bundle_type` (string)
    赠品捆绑包商品类型。仅适用于bundle赠品类型。
    Enum: "standard", "virtual_currency_package"

  - `items.promotions.limits` (object)

  - `items.promotions.limits.per_user` (object)

  - `items.promotions.limits.per_user.available` (integer)

  - `items.promotions.limits.per_user.total` (integer)

  - `items.limits` (object,null)
    商品限制数。

  - `items.limits.per_user` (object,null)
    单个用户的商品购买数量限制。

  - `items.limits.per_user.total` (integer)
    单个用户可购买的最大商品数量。
    Example: 5

  - `items.limits.per_user.available` (integer)
    当前用户可购买的剩余商品数量。
    Example: 3

  - `items.limits.per_user.recurrent_schedule` (any)

  - `items.limits.per_user.limit_exceeded_visibility` (string)
    设定商品在达到购买限制后、下次限制重置前在商品目录中的可见性。

适用于在recurrent_schedule数组中配置了周期性重置数量限制的商品。

如果未配置重置限制，则达到购买限制后，无论limit_exceeded_visibility的值如何，该商品都不会显示在商品目录中。

可能值：
- show — 达到购买限制后，商品目录检索API调用仍会返回该商品。在客户端侧
商品目录检索API调用中，达到限制后返回的商品会带有can_be_bought: false 标志。下一次重置日期
将在reset_next_date中返回。
- hide — 达到购买限制后，在限制
重置之前，商品目录检索API调用不会返回该商品。
    Enum: "show", "hide"

  - `items.limits.per_item` (object,null)
    单个商品的购买数量限制。

  - `items.limits.per_item.total` (integer)
    所有用户可购买的最大商品数量。
    Example: 5

  - `items.limits.per_item.available` (integer)
    所有用户还可购买的剩余商品数量。
    Example: 3

  - `items.periods` (array)
    商品销售期。

  - `items.periods.date_from` (string,null)
    指定商品开始可购的日期。
    Example: "2020-08-11T10:00:00+03:00"

  - `items.periods.date_until` (string,null)
    指定商品停止可购的日期。可为null。
    Example: "2020-08-11T20:00:00+03:00"

  - `items.custom_attributes` (object)
    包含商品属性和值的JSON对象。

  - `items.vp_rewards` (array)
    该商品的累充积分奖励列表。

  - `items.vp_rewards.item_id` (integer)
    内部唯一商品ID。

  - `items.vp_rewards.sku` (string)
    唯一累充积分ID。

  - `items.vp_rewards.amount` (integer)
    累充积分数量。

  - `items.vp_rewards.name` (string)
    累充积分名称。

  - `items.vp_rewards.image_url` (string)
    图片URL。

  - `items.vp_rewards.is_clan` (boolean)
    累充积分是否用于公会累充奖励链。

  - `items.loyalty_rewards` (array)
    用户购买商品后获得的忠诚积分奖励。

  - `items.loyalty_rewards.name` (string)
    忠诚积分名称。

  - `items.loyalty_rewards.sku` (string)
    忠诚积分SKU。调用其他API时，请将该值作为loyalty_point_sku参数传入，例如创建使用忠诚积分支付的订单时。

  - `items.loyalty_rewards.description` (string)
    忠诚积分描述。

  - `items.loyalty_rewards.image_url` (string,null)
    图片URL。

  - `items.loyalty_rewards.amount` (integer)
    用户购买商品后获得的忠诚积分数量。

  - `items.loyalty_prices` (array)
    可用于购买该商品的忠诚积分。

  - `items.loyalty_prices.name` (string)
    忠诚积分名称。

  - `items.loyalty_prices.sku` (string)
    忠诚积分SKU。调用其他API时，请将该值作为loyalty_point_sku参数传入，例如创建使用忠诚积分支付的订单时。

  - `items.loyalty_prices.description` (string)
    忠诚积分描述。

  - `items.loyalty_prices.image_url` (string,null)
    图片URL。

  - `items.loyalty_prices.amount` (integer)
    以指定忠诚积分计价的商品价格。

## Response 404 fields (application/json):

  - `statusCode` (integer)
    HTTP响应状态代码。
    Example: 404

  - `errorCode` (integer)
    艾克索拉错误代码
    Example: 4403

  - `errorMessage` (string)
    错误简要说明。
    Example: "[0401-4403]: Item group not found"


