[GH-ISSUE #314] API V2 的问题 #123

Closed
opened 2026-03-03 11:56:13 +03:00 by kerem · 1 comment
Owner

Originally created by @Kerrbty on GitHub (Jun 12, 2025).
Original GitHub issue: https://github.com/Finb/bark-server/issues/314

我的使用的是docker版本,/info 返回是

{
"version": "v2.2.1",
"build": "2025-05-12 06:42:16",
"arch": "linux/amd64",
"commit": "d32210d55c0316db13ea409cf457d338d11ce6ba",
"devices": 1
}
{
"version": "v2.2.1",
"build": "2025-05-12 06:42:16",
"arch": "linux/amd64",
"commit": "d32210d55c0316db13ea409cf457d338d11ce6ba",
"devices": 1
}

当我使用API V2的 POST JOSN 去测试,发现返回 “device key is empty”,如图:
Image

我修改代码,使用Form格式提交时候,反而成功了,如图:
Image

文档里面写错了,还是版本问题 ?

Originally created by @Kerrbty on GitHub (Jun 12, 2025). Original GitHub issue: https://github.com/Finb/bark-server/issues/314 我的使用的是docker版本,/info 返回是 ```json { "version": "v2.2.1", "build": "2025-05-12 06:42:16", "arch": "linux/amd64", "commit": "d32210d55c0316db13ea409cf457d338d11ce6ba", "devices": 1 } { "version": "v2.2.1", "build": "2025-05-12 06:42:16", "arch": "linux/amd64", "commit": "d32210d55c0316db13ea409cf457d338d11ce6ba", "devices": 1 } ``` 当我使用API V2的 POST JOSN 去测试,发现返回 “device key is empty”,如图: ![Image](https://github.com/user-attachments/assets/f56eaffe-dd8b-48d3-bd63-c4ccd5aa7aa6) 我修改代码,使用Form格式提交时候,反而成功了,如图: ![Image](https://github.com/user-attachments/assets/187c182a-5c6e-4180-826f-e636d6821030) 文档里面写错了,还是版本问题 ?
kerem closed this issue 2026-03-03 11:56:14 +03:00
Author
Owner

@Finb commented on GitHub (Jun 12, 2025):

请求不合规,需要添加请求头,指明是用json传递参数

Content-Type: application/json; charset=utf-8
<!-- gh-comment-id:2965822115 --> @Finb commented on GitHub (Jun 12, 2025): 请求不合规,需要添加请求头,指明是用json传递参数 ``` Content-Type: application/json; charset=utf-8 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bark-server#123
No description provided.