Files
spark-store/下载量统计接口规范.md

129 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 下载量统计接口规范
## 1. 获取下载次数
获取指定应用的下载次数
**URL**: `{SOURCE_URL}/{ARCH}/{CATOGARY}/{Package Name}/download-times.txt`
**请求方式**: GET
**示例**:
```
https://cdn.d.store.deepinos.org.cn/store/tools/spark-store/download-times.txt
https://cdn.d.store.deepinos.org.cn/amd64-store/office/wps/download-times.txt
https://cdn.d.store.deepinos.org.cn/aarch64-store/tools/spark-store/download-times.txt
```
**响应**: 纯文本,返回下载次数数字,如 `12345`
---
## 2. 上报下载次数 (apm-app-store)
apm-app-store 项目使用 HTTP POST 上报下载统计
**URL**: `{STATS_BASE_URL}/handle_post`
**请求方式**: POST
**请求头**:
```
Content-Type: application/json
```
**请求参数**:
```json
{
"path": "{ARCH}/{CATOGARY}/{Package Name}"
}
```
**示例**:
请求:
```
POST https://feedback.spark-app.store/handle_post
Content-Type: application/json
{
"path": "amd64-apm/office/wps"
}
```
---
## 3. 上报下载次数 (spark-store)
# Spark Store 评分反馈接口文档
## 接口概述
| 项目 | 内容 |
|------|------|
| 接口名称 | 应用评分反馈 |
| 接口地址 | `https://feedback.spark-app.store/handle_post` |
| 请求方式 | POST |
| 协议 | HTTPS |
---
## 请求头
| Header | 值 | 说明 |
|--------|-----|------|
| Content-Type | application/json | 请求数据类型 |
| User-Agent | Spark-Store/4.x | 客户端标识 |
---
## 请求参数
### 请求体 (JSON)
```json
{
"path": "应用安装路径"
}
```
| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| path | string | 是 | 应用在系统中的安装路径 |
---
## 响应结果
### 成功响应
```json
Finished
```
### 失败响应
```
Permission denied
```
---
## 调用示例
### cURL
```bash
curl -X POST "https://feedback.spark-app.store/handle_post" \
-H "Content-Type: application/json" \
-H "User-Agent: Spark-Store/4.x" \
-d '{"path":"/opt/spark-store/apps/com.example.app"}'
```
### Python
```python
import requests
url = "https://feedback.spark-app.store/handle_post"
headers = {
"Content-Type": "application/json",
"User-Agent": "Spark-Store/4.x"
}
data = {"path": "/opt/spark-store/apps/com.example.app"}
response = requests.post(url, json=data, headers=headers)
print(response.text)
```
---
## 错误码
| 错误信息 | 说明 |
|----------|------|
| Finished | 请求成功 |
| Permission denied | 权限不足或请求失败 |
说明:当应用下载成功后,客户端会自动发送下载统计数据到服务器。此接口主要用于内部统计,不建议外部直接调用。
请求体JSON格式包含应用元数据URL和统计标识符
注意:此接口由客户端自动调用,无需手动触发。