FastMoss Agent API

为智能机器人提供的数据查询接口

快速链接

报告生成 API

方式一:HTTP API(异步模式)

    # 1. 创建报告任务
    curl -X POST http://localhost:8888/api/v1/report/creator/async \
         -H "Content-Type: application/json" \
         -d '{"keywords": "mrbeast", "region": "US"}'
    
    # 返回: {"code": 0, "data": {"task_id": "xxx", "poll_url": "/api/v1/report/status/xxx"}}
    
    # 2. 查询任务状态
    curl http://localhost:8888/api/v1/report/status/xxx
    
    # 返回: {"code": 0, "data": {"status": "completed", "report_url": "http://..."}}
    
    # 3. 可选:添加Webhook回调
    curl -X POST http://localhost:8888/api/v1/report/creator/async \
         -H "Content-Type: application/json" \
         -d '{"keywords": "mrbeast", "callback_url": "https://your-app.com/webhook"}'
    

方式二:Python SDK

    from sdk import ReportClient
    
    client = ReportClient(base_url="http://your-server:8888")
    
    # 一行代码生成报告(自动等待完成)
    report_url = client.generate_report("creator", "mrbeast")
    print(report_url)  # http://server/api/v1/report/file/xxx.html
    
    # 或使用便捷方法
    url = client.generate_creator_report("mrbeast")
    url = client.generate_shop_report("Halara")
    url = client.generate_product_report("leggings")
    
    # 带进度回调
    def on_progress(progress, status):
        print(f"Progress: {progress}%")
    
    url = client.generate_report("creator", "mrbeast", on_progress=on_progress)
    

支持的报告类型

其他 API

    # 搜索达人
    curl -X POST http://localhost:8888/api/creator/search \
         -H "Content-Type: application/json" \
         -d '{"keywords": "mrbeast", "region": "US"}'
    
    # 搜索商品
    curl -X POST http://localhost:8888/api/product/search \
         -H "Content-Type: application/json" \
         -d '{"keywords": "charger", "region": "US"}'