seafile 社区版 6.0.4
调用API 创建用户,使用的账号是管理员账号
curl -v -X PUT -d “password=123456” -H “Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd” -H ‘Accept: application/json; indent=4’ https://cloud.seafile.com/api2/accounts/newaccount@gmail.com/
返回301
我看文档上写的是201
然后使用管理员登陆后查看用户,无刚才创建的用户
更新用户信息的API 也是如此,返回301
seahub.log 中显示的日志是
seahub.api2.serializers:93 validate xxxxxxx@126.com unrecognized device
调用API时 还需要验证设备?
或者说这些特殊的API 只能使用客户端或者通过web界面来操作?
很长时间没有回复,还是自己解决吧.看了下源码,API验证
在validate方法中有对plateform参数的验证
if platform in DESKTOP_PLATFORMS:
if not user.permissions.can_connect_with_desktop_clients():
raise serializers.ValidationError(‘Not allowed to connect to desktop client.’)
elif platform == ‘android’:
if not user.permissions.can_connect_with_android_clients():
raise serializers.ValidationError(‘Not allowed to connect to android client.’)
elif platform == ‘ios’:
if not user.permissions.can_connect_with_ios_clients():
raise serializers.ValidationError(‘Not allowed to connect to ios client.’)
else:
logger.info(‘%s: unrecognized device’ % login_id)
而DESKTOP_PLATEFORM中包含的有 windows mac linux
DESKTOP_PLATEFORM
测试返回结果
<301 Moved Permanently,{Server=[gunicorn/19.4.5], Date=[Tue, 28 Feb 2017 06:31:49 GMT], Connection=[close], Transfer-Encoding=[chunked], Vary=[Accept-Language, Cookie], Content-Type=[text/html; charset=utf-8], Location=[http://10.3.26.100:8000/api2/accounts/newaccount_928%40126.com/], Content-Language=[en]}>