ARNPROXY

位置与租期

GET/account/api/v1/catalog

授权

AuthorizationBearer YOUR_ARNPROXY_API_KEY
所需权限read
Acceptapplication/json

参数

名称类型说明
product_id
query必填
integerproducts 返回的产品 ID,1–2147483647。

更多使用示例

ID 和价格仅供示例,请使用目录及同一次报价中的实际值。JSON ID 和 expected_total_minor 必须是数字。示例刻意保留 terms=false;只有客户明确同意实际付费操作后才应发送 terms=true。

使用用途:只需选择子用途

标准订单不应让客户选择两次。请在 catalog.purposes 中找到 id=201,并仅展示其 children。purchase 中的 purpose_id 固定为整数 201,subpurpose_id 为所选子项的 ID。保留层级结构是为了兼容现有集成。

Node.js / JavaScript
const response = await fetch(
  'https://www.arnproxy.com/account/api/v1/catalog?product_id=' + productId,
  { headers: { Authorization: 'Bearer ' + apiKey } }
);
const catalog = await response.json();
if (!response.ok || !catalog.ok) throw new Error('Catalog request failed');
const purposeGroup = catalog.data.purposes.find(group => group.id === 201);
if (!purposeGroup) throw new Error('Purpose group 201 is not available');
const purposeOptions = purposeGroup.children.map(({ id, name }) => ({ id, name }));
// Show only purposeOptions. The customer selects selectedSubpurposeId.
const purchaseLine = {
  location_id: selectedLocationId,
  time_id: selectedTimeId,
  quantity: selectedQuantity,
  purpose_id: 201,
  subpurpose_id: selectedSubpurposeId
};
// Add other_purpose (1–30 characters) only when selectedSubpurposeId === -1.
// No purchase is sent by this example.

使用用途:只需选择子用途

标准订单不应让客户选择两次。请在 catalog.purposes 中找到 id=201,并仅展示其 children。purchase 中的 purpose_id 固定为整数 201,subpurpose_id 为所选子项的 ID。保留层级结构是为了兼容现有集成。

Python
import json
import urllib.request

request = urllib.request.Request(
    'https://www.arnproxy.com/account/api/v1/catalog?product_id=' + str(product_id),
    headers={'Authorization': 'Bearer ' + api_key}
)
with urllib.request.urlopen(request, timeout=20) as response:
    catalog = json.load(response)
if not catalog.get('ok'):
    raise RuntimeError('Catalog request failed')
purpose_group = next((g for g in catalog['data']['purposes'] if g['id'] == 201), None)
if purpose_group is None:
    raise RuntimeError('Purpose group 201 is not available')
purpose_options = [{'id': p['id'], 'name': p['name']} for p in purpose_group['children']]
# Display only purpose_options; the customer selects selected_subpurpose_id.
purchase_line = {
    'location_id': selected_location_id,
    'time_id': selected_time_id,
    'quantity': selected_quantity,
    'purpose_id': 201,
    'subpurpose_id': selected_subpurpose_id,
}
# For Other (-1), also set other_purpose to 1–30 characters.
# This example does not submit a purchase.

请求示例

cURL
printf 'Authorization: Bearer %s\n' "$ARNPROXY_API_KEY" |
  curl --silent --show-error --header @- \
    --header 'Accept: application/json' \
    --connect-timeout 10 --max-time 30 \
    'https://www.arnproxy.com/account/api/v1/catalog?product_id=FROM_PRODUCTS'

本页不会执行示例。请将 API 密钥保存在服务器环境变量中,不要放入 URL 或浏览器代码。POST 示例需准备 request.json。

响应

200成功响应
application/json
{
    "ok": true,
    "data": {
        "product": {
            "id": 5,
            "name": "IPv4 Proxy",
            "minimum_quantity": 1
        },
        "currency": "TRY",
        "locations": [
            {
                "id": 10,
                "name": "Example country",
                "periods": [
                    {
                        "id": 101,
                        "name": "7 days",
                        "days": 7,
                        "base_unit_price": "10.0000"
                    }
                ]
            }
        ],
        "purposes": [
            {
                "id": 201,
                "name": "Purpose",
                "children": [
                    {
                        "id": 202,
                        "name": "Example purpose"
                    }
                ]
            }
        ],
        "discount_scope": "country",
        "stock_checked": false,
        "purchase_available": true
    },
    "meta": {
        "request_id": "000000000000000000000001",
        "phase": "public_v1",
        "source": "arnproxy_records"
    }
}
响应字段与类型
名称类型说明
okboolean成功标志;为 false 时请检查 error.code。
dataobject操作特定结果;示例均为演示用合成数据。
data.productobjectproduct 的操作特定值。请保留返回类型并查阅行为说明。
data.product.idinteger相关 ARNPROXY 记录 ID,请勿替换为上游内部 ID。
data.product.namestringname 的操作特定值。请保留返回类型并查阅行为说明。
data.product.minimum_quantityinteger此产品每条订单行的最小数量。
data.currencystring账户交易币种:TRY 或 USD。
data.locationsarraylocations 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[]objectlocations 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[].idinteger相关 ARNPROXY 记录 ID,请勿替换为上游内部 ID。
data.locations[].namestringname 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[].periodsarrayperiods 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[].periods[]objectperiods 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[].periods[].idinteger相关 ARNPROXY 记录 ID,请勿替换为上游内部 ID。
data.locations[].periods[].namestringname 的操作特定值。请保留返回类型并查阅行为说明。
data.locations[].periods[].daysinteger方案天数,与 GB 方案流量数量分开。
data.locations[].periods[].base_unit_pricestringbase unit price 的操作特定值。请保留返回类型并查阅行为说明。
data.purposesarraypurposes 的操作特定值。请保留返回类型并查阅行为说明。
data.purposes[]objectpurposes 的操作特定值。请保留返回类型并查阅行为说明。
data.purposes[].idinteger相关 ARNPROXY 记录 ID,请勿替换为上游内部 ID。
data.purposes[].namestringname 的操作特定值。请保留返回类型并查阅行为说明。
data.purposes[].childrenarraychildren 的操作特定值。请保留返回类型并查阅行为说明。
data.purposes[].children[]objectchildren 的操作特定值。请保留返回类型并查阅行为说明。
data.purposes[].children[].idinteger相关 ARNPROXY 记录 ID,请勿替换为上游内部 ID。
data.purposes[].children[].namestringname 的操作特定值。请保留返回类型并查阅行为说明。
data.discount_scopestringdiscount scope 的操作特定值。请保留返回类型并查阅行为说明。
data.stock_checkedboolean仅凭价格/本地结果不能保证上游可用性或库存。
data.purchase_availableboolean根据响应条件/权限确定的可用性,不代表库存或上游可用性保证。
metaobject请求关联与数据来源元信息。
meta.request_idstring此 HTTP 请求的跟踪 ID,不是操作键或订单 ID。
meta.phasestringphase 的操作特定值。请保留返回类型并查阅行为说明。
meta.sourcestring数据来源;本地记录与实时上游查询属于不同证据。

错误响应

HTTP 401 · INVALID_API_KEY
{
  "ok": false,
  "error": { "code": "INVALID_API_KEY" },
  "meta": { "request_id": "000000000000000000000001" }
}

身份验证和参数校验可能在执行前拒绝请求。请查阅错误参考,联系支持时保留 request_id。切勿发送密钥或密码。 错误与限制 →

行为与重要说明

  • 从 products/catalog 获取 ID。quote 行仅含 location_id、time_id、quantity。purchase 行还必须有 purpose_id=201 和所选 subpurpose_id。
  • 标准订单不应让客户选择两次。请在 catalog.purposes 中找到 id=201,并仅展示其 children。purchase 中的 purpose_id 固定为整数 201,subpurpose_id 为所选子项的 ID。保留层级结构是为了兼容现有集成。
  • 选择“其他”时,发送 subpurpose_id=-1 和包含 1–30 个字符的 other_purpose。其他选项无需 other_purpose。purpose_id 仍为 201。

搜索当前语言。关闭: Esc