该应用程序允许限制外部链接共享的下载数量。
下面的示例可以使用 hurl 运行。
提示
要忽略断言,请传递--ignore-asserts
标志。
外部共享限制可以通过其令牌查询。
hurl get.hurl --variable token='2Nyq27RKT7Jw9q3'
获取.hurl
GET https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit
OCS-APIRequest: true
Accept: application/json
[BasicAuth]
alice: alice
HTTP 200
[Asserts]
jsonpath "$.ocs.data.limit" exists
jsonpath "$.ocs.data.count" exists
hurl propfind.hurl --变量所有者=admin --变量路径=/welcome.txt
propfind.hurl
PROPFIND https://nextcloud.local/remote.php/dav/files/{{owner}}/{{path}}
[BasicAuth]
{{owner}}: {{owner}}
```xml
```
HTTP 207
[Asserts]
xpath "//nc:share-download-limits" isCollection
hurl set.hurl --变量标记='2Nyq27RKT7Jw9q3' --变量限制=5
设置.hurl
PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit
OCS-APIRequest: true
Accept: application/json
[BasicAuth]
alice: alice
{
"limit": {{limit}}
}
HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty
hurl remove.hurl --variable token='2Nyq27RKT7Jw9q3'
删除.hurl
DELETE https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit
OCS-APIRequest: true
Accept: application/json
[BasicAuth]
alice: alice
HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty
管理员可以设置默认限制。
hurl set-default.hurl --变量限制=1
设置默认值.hurl
PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/limit
OCS-APIRequest: true
Accept: application/json
[BasicAuth]
admin: admin
{
"limit": {{limit}}
}
HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty