json - 为什么 curl json 身份验证不起作用?
问题描述
当我使用此代码进行身份验证时:
curl -d -H "Accept: application/json" \
{"id":"1","method":"authenticate","params":{"user":"USER","password":"PASSWORD","client":"CLIENT", "?school":"htl-donaustadt"},"jsonrpc":"2.0"} \
https://melete.webuntis.com/WebUntis/jsonrpc.do?school=htl-donaustadt \
--insecure
我收到此错误消息:
curl:(3)[globbing]第27列中不匹配的右大括号/方括号
{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"解析错误:由于输入结束,没有要映射的内容\n at [来源:org.apache.catalina.connector.CoyoteInputStream@102d63fc;行:1,列:0]"}}
解决方案
根据一些非公开文档,您需要做的是对https://server.webuntis.com/WebUntis/jsonrpc.do?school=School+name
url 的请求,并以此作为正文。很抱歉,我无法与您分享文档。我想你可以在 untis 帮助台上申请。
{
"params": {
"user": "xxx_user",
"password": "xxx_password",
"client": "Roostersync proxy"
},
"id": "random_id_here",
"method": "authenticate",
"jsonrpc": "2.0"
}
或者 curl 命令
curl -X POST \
'https://melete.webuntis.com/WebUntis/jsonrpc.do?school=htl-donaustadt' \
-H 'Content-Type: application/json' \
-d '{
"params": {
"user": "user",
"password": "password",
"client": "Your client name"
},
"id": "7e6431bc-36c2-4118-991d-6459ab5b01e2",
"method": "authenticate",
"jsonrpc": "2.0"
}'
推荐阅读
- c# - 从 startup.cs 检查令牌有效性
- java - java:将字符串转换为希腊字符
- python - Python Flask:单击通过单击另一个按钮呈现的按钮
- javascript - 单击按钮时触发键盘事件
- hibernate - 使用 Hibernate 创建表
- python-3.x - 在networkx中按顺序获取源的祖先
- java - 如何获取在使用 Selenium 路由到另一个 url 之前临时出现的重定向 url?
- angular - 如何从angular4中的表单中删除formGroup?
- asp.net - 如何在 asp.net 中将 Fileupload 绑定到 Image 控件
- android - 如何从本地sqlite糖数据库android中检索数据