8000 api接口格式问题 · Issue #643 · Qexo/Qexo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

api接口格式问题 #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
8000
yuzhi-jiang opened this issue Apr 4, 2025 · 15 comments
Open

api接口格式问题 #643

yuzhi-jiang opened this issue Apr 4, 2025 · 15 comments
Labels
完成 这项工作已经完成 错误 程序问题

Comments

@yuzhi-jiang
Copy link

Qexo 版本

v3.5.3

平台

vercel

问题描述

想做一个qexo的mcp-server但是发现除了get_post不需要参数的拿到了数据对接成功,其他的如new,save_post
参数试了挺多中方法都不行,请问这些参数具体是什么格式? 或者qexo有打算做qexo-mcp-server吗

复现链接

No response

截图

Image

Image

Image

@yuzhi-jiang
Copy link
Author

补充: qexo版本是3.6.0

@am-abudu
Copy link
Member
am-abudu commented Apr 4, 2025

抱歉,对公API在2.0-3.0版本更新中年久失修导致一些API无法正常工作。

请告诉我你需要使用的API,我会对此进行调整修复

@am-abudu
Copy link
Member
am-abudu commented Apr 4, 2025

或许mcp-server可以直接使用Qexo的子模块 hexoweb/libs/platform 快速完成?

@yuzhi-jiang
Copy link
Author

我需要使用的api包括
查找过滤文章(文字包含title),如果可以过滤内容的话最佳
新增文章(标题,内容,tags)
修改文章(标题,内容,tags)
删除文章(id/path),
pub/get_posts/,希望有page,total,如果page不好弄,希望加个total字段
这是我日常需要使用的操作,
对于其他的如果有最好,我会接入mcp

@yuzhi-jiang
Copy link
Author

或许mcp-server可以直接使用Qexo的子模块 hexoweb/libs/platform 快速完成?

还未看过源码,如果模块集成方便的话,我也可以使用hexoweb/libs/platform

@am-abudu
Copy link
Member
am-abudu commented Apr 4, 2025

了解了,相关内容我会在明天晚些时候调整。你也可以先尝试下这个子模块,可以直接作为 python 模块调用,相关使用方法可以参考 api.py 以及 functions.py

@am-abudu am-abudu added the 错误 程序问题 label Apr 4, 2025
Copy link
Author

了解了,相关内容我会在明天晚些时候调整。你也可以先尝试下这个子模块,可以直接作为 python 模块调用,相关使用方法可以参考 api.py 以及 functions.py

好的

am-abudu added a commit that referenced this issue Apr 5, 2025
@am-abudu
Copy link
Member
am-abudu commented Apr 5, 2025

我已经完成更新,请尝试Dev分支

@yuzhi-jiang
Copy link
Author

我尝试了一下,api报错依然是一样的(和之前截图一样的格式)
对于集成代码,我粗鲁看了下源码,api.py和function.py和pub.py,是与reqeuest绑定没有中间层,所以一时之间我不知道怎么集成比较好,我尝试将源码uv pip install . 安装到项目,遗憾的是build error: Multiple top-level packages discovered in a flat-layout: ['db', 'core', 'hexoweb'].,而通过查询资料将py-modules=[]或者py-modules = [
"core","db","hexoweb"
]可以构建,但是似乎并不能识别出代码,导致打包只要info,而无具体代码,导致在项目中无法使用import qexo,

============
我设想,作者对于代码比较熟悉,能否有空的时候将core抽出来,通过setting(xxx,xxx)设置qexo需要配置,然后得到一样qexo_client=Qexo(),通过qexo_clietn去操作。
将以上代码作为一个model/package,发布或者提供setup.py文件pyproject.toml,使之可以publish到pypi或者本地pip install .
以方便集成呢

Image

@yuzhi-jiang
Copy link
Author

我尝试了一下,api报错依然是一样的(和之前截图一样的格式) 对于集成代码,我粗鲁看了下源码,api.py和function.py和pub.py,是与reqeuest绑定没有中间层,所以一时之间我不知道怎么集成比较好,我尝试将源码uv pip install . 安装到项目,遗憾的是build error: Multiple top-level packages discovered in a flat-layout: ['db', 'core', 'hexoweb'].,而通过查询资料将py-modules=[]或者py-modules = [ "core","db","hexoweb" ]可以构建,但是似乎并不能识别出代码,导致打包只要info,而无具体代码,导致在项目中无法使用import qexo,

============ 我设想,作者对于代码比较熟悉,能否有空的时候将core抽出来,通过setting(xxx,xxx)设置qexo需要配置,然后得到一样qexo_client=Qexo(),通过qexo_clietn去操作。 将以上代码作为一个model/package,发布或者提供setup.py文件pyproject.toml,使之可以publish到pypi或者本地pip install . 以方便集成呢

Image

基于dev分支

@am-abudu
Copy link
Member
am-abudu commented Apr 6, 2025

抱歉,最新的更改对api格式做出了调整,稍后我会上传一份新的api文档

@am-abudu
Copy link
Member
am-abudu commented Apr 6, 2025

Qexo API文档

通用说明

  • 大部分API需要鉴权,请在调用前确保已经获得了有效的鉴权信息
  • 所有API返回JSON格式数据,包含status字段表示操作是否成功
  • 错误信息包含在msg字段中

内容管理

保存内容

  • 地址: /pub/save
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • file: 文件路径
    • content: 文件内容
    • commitchange: 提交信息(可选,默认为"Update {file} by Qexo")
  • 返回: {"msg": "OK!", "status": true} 或错误信息

删除内容

  • 地址: /pub/delete
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • file: 要删除的文件路径
    • commitchange: 提交信息(可选,默认为"Delete {file} by Qexo")
  • 返回: 成功或错误信息

文章、页面与配置

获取所有文章

  • 地址: /pub/get_posts
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 文章列表

获取所有页面

  • 地址: /pub/get_pages
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 页面列表

获取所有配置

  • 地址: /pub/get_configs
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 配置列表

获取所有图片

  • 地址: /pub/get_images
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 图片列表

友情链接管理

获取显示中的友情链接

  • 地址: /pub/friends
  • 方法: GET/POST
  • 鉴权: 不需要
  • 返回: 显示中的友链列表

获取全部友情链接

  • 地址: /pub/get_friends
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 所有友链列表

申请友情链接

  • 地址: /pub/ask_friend
  • 方法: POST
  • 鉴权: 不需要
  • 参数:
    • name: 网站名称
    • url: 网站链接
    • image: 网站图标
    • description: 网站描述
    • verify: 人机验证token(如果启用)
  • 返回: 申请结果

新增友情链接

  • 地址: /pub/add_friend
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • name: 网站名称
    • url: 网站链接
    • image: 网站图标
    • description: 网站描述
    • status: 显示状态
  • 返回: 操作结果

编辑友情链接

  • 地址: /pub/edit_friend
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • time: 友链标识时间戳
    • name: 网站名称
    • url: 网站链接
    • image: 网站图标
    • description: 网站描述
    • status: 显示状态
  • 返回: 操作结果

删除友情链接

  • 地址: /pub/del_friend
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • time: 友链标识时间戳
  • 返回: 操作结果

自定义字段管理

获取自定义字段

  • 地址: /pub/get_custom
  • 方法: GET/POST
  • 鉴权: 不需要
  • 参数:
    • key: 自定义字段键名
  • 返回: 字段内容

编辑自定义字段

  • 地址: /pub/set_custom
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • name: 字段名
    • content: 字段内容
  • 返回: 操作结果

删除自定义字段

  • 地址: /pub/del_custom
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • name: 字段名
  • 返回: 操作结果

新建自定义字段

  • 地址: /pub/new_custom
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • name: 字段名
    • content: 字段内容
  • 返回: 操作结果

通知与统计

获取全部消息

  • 地址: /pub/get_notifications
  • 方法: GET/POST
  • 鉴权: 必需
  • 返回: 消息列表

创建自定义通知

  • 地址: /pub/notifications
  • 方法: POST
  • 鉴权: 必需
  • 参数(JSON格式):
    • title: 通知标题
    • content: 通知内容
  • 返回: 操作结果

获取博客基本信息

  • 地址: /pub/status
  • 方法: GET/POST
  • 鉴权: 不需要
  • 返回: 博客信息(文章数量、最后登录时间)

统计API

  • 地址: /pub/statistic
  • 方法: GET/POST
  • 鉴权: 不需要(但需要域名验证)
  • 返回: 站点访问统计信息

说说管理

获取说说

  • 地址: /pub/talks
  • 方法: GET
  • 鉴权: 不需要
  • 参数:
    • page: 页码(可选,默认1)
    • limit: 每页数量(可选,默认5)
  • 返回: 说说列表

点赞说说

  • 地址: /pub/like_talk
  • 方法: POST
  • 鉴权: 不需要
  • 参数:
    • id: 说说ID
  • 返回: 点赞结果

保存说说

  • 地址: /pub/save_talk
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • id: 说说ID(更新时提供)
    • content: 说说内容
    • tags: 说说标签
    • time: 时间(更新时提供)
    • values: 附加值
  • 返回: 操作结果

删除说说

  • 地址: /pub/del_talk
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • id: 说说ID
  • 返回: 操作结果

获取全部说说

  • 地址: /pub/get_all_talks
  • 方法: GET
  • 鉴权: 必需
  • 参数:
    • s: 搜索关键词(可选)
  • 返回: 说说列表

系统管理

自动修复程序

  • 地址: /pub/auto_fix
  • 方法: GET/POST
  • 鉴权: 必需
  • 返回: 修复结果

自动设置Webhook

  • 地址: /pub/create_webhook
  • 方法: POST
  • 鉴权: 必需
  • 参数:
    • uri: Webhook回调URL
  • 返回: 操作结果

@yuzhi-jiang
Copy link
Author

好的,基于刚才的问题,save是更新和新增是统一了吗
我用save测试了一个,有以下报错
Image

@am-abudu
Copy link
Member
am-abudu commented Apr 6, 2025

我刚测试了下可用,是否是你的调用格式存在问题?

import requests
a = requests.post("https://xxx/pub/save/?token=xxx", {"file":"testfile", "content": "test"})
a.text

@yuzhi-jiang
Copy link
Author

是的,我使用的是application/json格式
我刚才使用multipart/form-data; boundary=--------------------------407396309576686755681656
是调用成功了

Image

@am-abudu am-abudu added the 完成 这项工作已经完成 label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
完成 这项工作已经完成 错误 程序问题
Projects
None yet
Development

No branches or pull requests

2 participants
0