Zepp刷步数[code版]

Zepp刷步数[code版]

需要传入参数code,支持新号。

GET&POST JSON 总调用: 0 次
接口状态:正常

接口详情

GET&POST
JSON

接口状态

调用频率 无限制
响应时间 测速中
稳定性 稳定

请求参数

参数名 是否必填 类型 说明 示例
username string Zepp账号

示例代码

HTTP 请求
https://api.bugpk.com/api/zepp?username=Zepp账号&password=Zepp密码&step=88888
JavaScript 示例
// 使用 Fetch API 调用接口
const apiUrl = 'https://api.bugpk.com/api/zepp';

// 准备请求参数
const params = {
    key1: 'value1',
    key2: 'value2',
    // 根据实际参数添加
};

// GET 请求示例
async function getRequest() {
    try {
        const queryParams = new URLSearchParams(params).toString();
        const url = `${apiUrl}?${queryParams}`;
        
        const response = await fetch(url, {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
            },
        });
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        console.log('响应数据:', data);
        return data;
    } catch (error) {
        console.error('请求失败:', error);
        throw error;
    }
}

// POST 请求示例
async function postRequest() {
    try {
        const response = await fetch(apiUrl, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(params),
        });
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        console.log('响应数据:', data);
        return data;
    } catch (error) {
        console.error('请求失败:', error);
        throw error;
    }
}

// 根据请求方法调用对应的函数
const method = 'GET&POST';
if (method === 'GET') {
    getRequest();
} else if (method === 'POST') {
    postRequest();
}
PHP 示例
// 使用 cURL 调用接口
$apiUrl = 'https://api.bugpk.com/api/zepp';
$method = 'GET&POST';

// 准备请求参数
$params = [
    'key1' => 'value1',
    'key2' => 'value2',
    // 根据实际参数添加
];

function callApi($url, $method, $params = []) {
    $ch = curl_init();
    
    // 设置 cURL 选项
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    
    // 设置请求头
    $headers = [
        'Content-Type: application/json',
    ];
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    if ($method === 'GET') {
        // GET 请求
        $queryString = http_build_query($params);
        $fullUrl = $url . '?' . $queryString;
        curl_setopt($ch, CURLOPT_URL, $fullUrl);
    } else {
        // POST/PUT/DELETE 请求
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
        if (!empty($params)) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
        }
    }
    
    // 执行请求
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    
    if (curl_error($ch)) {
        throw new Exception('cURL Error: ' . curl_error($ch));
    }
    
    curl_close($ch);
    
    // 解析响应
    $data = json_decode($response, true);
    
    if (json_last_error() !== JSON_ERROR_NONE) {
        throw new Exception('JSON 解析错误: ' . json_last_error_msg());
    }
    
    return [
        'status' => $httpCode,
        'data' => $data
    ];
}

try {
    $result = callApi($apiUrl, $method, $params);
    echo "请求成功:\n";
    print_r($result['data']);
} catch (Exception $e) {
    echo "请求失败: " . $e->getMessage() . "\n";
}
Python 示例
import requests
import json

# API 配置
api_url = 'https://api.bugpk.com/api/zepp'
method = 'get&post'

# 准备请求参数
params = {
    'key1': 'value1',
    'key2': 'value2',
    # 根据实际参数添加
}

# 设置请求头
headers = {
    'Content-Type': 'application/json',
    'User-Agent': 'API-Client/1.0'
}

def call_api():
    try:
        if method == 'get':
            # GET 请求
            response = requests.get(
                api_url,
                params=params,
                headers=headers,
                timeout=30
            )
        else:
            # POST/PUT/DELETE 请求
            data = json.dumps(params)
            if method == 'post':
                response = requests.post(api_url, data=data, headers=headers, timeout=30)
            elif method == 'put':
                response = requests.put(api_url, data=data, headers=headers, timeout=30)
            elif method == 'delete':
                response = requests.delete(api_url, data=data, headers=headers, timeout=30)
            else:
                raise ValueError(f"不支持的请求方法: {method}")
        
        # 检查响应状态
        response.raise_for_status()
        
        # 解析 JSON 响应
        result = response.json()
        
        print("请求成功!")
        print(f"状态码: {response.status_code}")
        print("响应数据:")
        print(json.dumps(result, indent=2, ensure_ascii=False))
        
        return result
        
    except requests.exceptions.RequestException as e:
        print(f"请求失败: {e}")
        return None
    except json.JSONDecodeError as e:
        print(f"JSON 解析失败: {e}")
        return None

# 调用接口
if __name__ == "__main__":
    result = call_api()
Java 示例
import java.io.*;
import java.net.*;
import java.util.HashMap;
import java.util.Map;

public class ApiClient {
    private static final String API_URL = "https://api.bugpk.com/api/zepp";
    private static final String METHOD = "GET&POST";
    
    public static void main(String[] args) {
        try {
            // 准备请求参数
            Map params = new HashMap<>();
            params.put("key1", "value1");
            params.put("key2", "value2");
            // 根据实际参数添加
            
            String response = callApi(API_URL, METHOD, params);
            System.out.println("响应结果: " + response);
        } catch (Exception e) {
            System.err.println("请求失败: " + e.getMessage());
        }
    }
    
    public static String callApi(String url, String method, Map params) throws IOException {
        HttpURLConnection connection = null;
        
        try {
            if (method.equals("GET")) {
                // GET 请求
                String queryString = buildQueryString(params);
                String fullUrl = url + "?" + queryString;
                
                URL apiUrl = new URL(fullUrl);
                connection = (HttpURLConnection) apiUrl.openConnection();
                connection.setRequestMethod("GET");
            } else {
                // POST/PUT/DELETE 请求
                URL apiUrl = new URL(url);
                connection = (HttpURLConnection) apiUrl.openConnection();
                connection.setRequestMethod(method);
                connection.setDoOutput(true);
                
                // 设置请求体
                String requestBody = buildJsonBody(params);
                try (OutputStream os = connection.getOutputStream()) {
                    byte[] input = requestBody.getBytes("utf-8");
                    os.write(input, 0, input.length);
                }
            }
            
            // 设置请求头
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("User-Agent", "API-Client/1.0");
            connection.setConnectTimeout(30000);
            connection.setReadTimeout(30000);
            
            // 获取响应
            int status = connection.getResponseCode();
            
            StringBuilder response = new StringBuilder();
            try (BufferedReader br = new BufferedReader(
                new InputStreamReader(connection.getInputStream(), "utf-8"))) {
                String responseLine;
                while ((responseLine = br.readLine()) != null) {
                    response.append(responseLine.trim());
                }
            }
            
            if (status != 200) {
                throw new IOException("HTTP 错误代码: " + status);
            }
            
            return response.toString();
            
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
    
    private static String buildQueryString(Map params) throws UnsupportedEncodingException {
        StringBuilder result = new StringBuilder();
        for (Map.Entry entry : params.entrySet()) {
            if (result.length() > 0) {
                result.append("&");
            }
            result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
            result.append("=");
            result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
        }
        return result.toString();
    }
    
    private static String buildJsonBody(Map params) {
        StringBuilder json = new StringBuilder();
        json.append("{");
        boolean first = true;
        for (Map.Entry entry : params.entrySet()) {
            if (!first) {
                json.append(",");
            }
            json.append("\"").append(entry.getKey()).append("\":\"").append(entry.getValue()).append("\"");
            first = false;
        }
        json.append("}");
        return json.toString();
    }
}
cURL 示例
# API 配置
API_URL="https://api.bugpk.com/api/zepp"
METHOD="GET&POST"

# GET&POST 请求示例
curl -X GET&POST \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -H "User-Agent: API-Client/1.0" \
  -d '{
    "key1": "value1",
    "key2": "value2"
  }'


# 带详细输出的 cURL 命令
curl -v \
  -X GET&POST \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"key1":"value1","key2":"value2"}' \
  --connect-timeout 30 \
  --max-time 60

# 将响应保存到文件
curl -X GET&POST \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -d '{"key1":"value1","key2":"value2"}' \
  -o response.json

# 使用变量参数的示例
KEY1="value1"
KEY2="value2"

curl -X GET&POST \
  "$API_URL" \
  -H "Content-Type: application/json" \
  -d "{\"key1\":\"$KEY1\",\"key2\":\"$KEY2\"}"

返回示例

JSON 响应
{
    "code": 200,
    "msg": "步数同步成功!",
    "user": "197****837@qq.com",
    "step": "8888",
    "now": "2025-10-09 03:16:58",
    "Author": "JH-Ahua",
    "ip": "39.144.108.103",
    "bind_status": 1,
    "bind_msg": "绑定成功",
    "tip": "接口由BugPk-Api提供,仅供学习。",
    "link": "https://api.bugpk.com/"
}

响应参数

参数名 类型 说明 示例
code string 状态码
msg string 提示信息
user string 提交的账号
step int 提交的步数
now string 提交时间

在线请求

该接口仅支持 GET&POST 请求

响应结果
发送请求后,响应结果将显示在这里...