我正在开发下一个云服务器。我正在从客户端(Android)创建服务器上的文件夹并成功上传/下载文件。我需要将新用户添加到下一个云服务器中。我正在使用指南 Next Cloud User Provisioning API
在这里,我想点击服务器,请告诉我在标题和内容类型部分写什么。我收到响应代码= 200,但是当我打开返回的url时,它会给出“invalide query”。有什么帮助吗?
答案 0 :(得分:0)
这些API文档中有一些遗漏 - 对于某些成功请求,需要将此'OCS-APIREQUEST'
标头设置为true
;在你的情况下:
curl -X POST https://<your-owncloud>/ocs/v1.php/cloud/users?format=json \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'OCS-APIREQUEST: true' \
-d 'userid=<username>&password=<password>'
将返回:
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": null
},
"data": []
}
}
"statuscode": 100
表示已创建用户。这对你有用吗?
有关此请求的(非标准)状态代码的详细信息,请查看:https://doc.owncloud.org/server/latest/admin_manual/configuration/user/user_provisioning_api.html#users-adduser