# 获取优惠券码

获取优惠券码。

响应包含该促销活动中的兑换码总数（total_count）以及当前页面的兑换码（codes）。如需获取下一页，请按limit的值递增offset（例如先传“offset”: 100，再传“offset”: 200），直到获取全部兑换码。

在大多数情况下，“limit”: 100或“limit”: 1000即可满足需求。较大的值（如“limit”: 10000）建议仅用于一次性批量导出；除非必要，请避免使用“limit”: 50000。

Endpoint: GET /v2/project/{project_id}/admin/coupon/{external_id}/code
Version: 2.0.0
Security: basicAuth

## Path parameters:

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

  - `external_id` (integer, required)
    促销活动外部ID。项目内的唯一促销活动标识符。
    Example: "coupon_44056_1"

## Query parameters:

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

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

## Response 200 fields (application/json):

  - `codes` (array)

  - `codes.code` (string)
    区分大小写的唯一兑换码。包含字母和数字。

  - `total_count` (number)
    优惠券码总数。

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1020

  - `errorMessage` (string)
    Example: "[0401-1020]: Error in Authentication method occurred"

## Response 404 fields (application/json):

  - `statusCode` (integer)
    Example: 404

  - `errorCode` (integer)
    Example: 4001

  - `errorMessage` (string)
    Example: "[0401-9802]: Coupon not found"

  - `transactionId` (string)
    Example: "x-x-x-x-transactionId-mock-x-x-x"


