获取某个类别的全部词条信息

1. 接口地址

https://www.hidreamai.com/api-pub/dc/v1/phrases/<category_en>

 

2. 请求方式

GET

 

3. 请求参数

Header

参数 类型 是否必填 说明
Authorization string 客户授权Token

Path Params

参数 类型 是否必填 说明
category_en string 查询类别的英文名称,所选择词条所属类别的category_en值

Query Params

参数 类型 是否必填 说明
query string 模糊查询关键字
page_index int 分页参数:当前页索引
page_size int 分页参数:每页数据量,最大值50

curl示例

curl -H 'Authorization: Bearer {USER_Authorization}' -X GET 
-v 'https://www.hidreamai.com/api-pub/dc/v1/phrases/Color?page_index=1&page_size=20'

Python示例

import requests
import json
import uuid

USER_Authorization = <token>  # 获取方式详见接口文档https://www.hidreamai.com/docs/pixeling/user/token.html


# 请求头
headers = {
    'Authorization': f'Bearer {USER_Authorization}'
}

# 请求参数
category_en = "Color"
page_index=1
page_size=20

# 发送GET请求
url = f'https://www.hidreamai.com/api-pub/dc/v1/phrases/{category_en}?page_index={page_index}&page_size={page_size}'
response = requests.get(url, headers=headers)

# 处理响应
if response.status_code == 200:
    if response.json()['code'] == 0:
        result = response.json()['result']
        print(result)
    else:
        print(response.json()['message'])
else:
    print(response.status_code)

 

4. 返回参数

参考接口词库全部类别接口返回参数

results matching ""

    No results matching ""

    results matching ""

      No results matching ""