Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

fetch shares using json instead of XML #1147

Open
butonic opened this issue Sep 12, 2022 · 2 comments
Open

fetch shares using json instead of XML #1147

butonic opened this issue Sep 12, 2022 · 2 comments

Comments

@butonic
Copy link
Member

butonic commented Sep 12, 2022

We should use JSON to fetch shares instead of XML. With hundreds of shares (in this case 500) the savings become noticeable:

vscode ➜ ~/repositories/reva (prefer-return-minimal ✗) $ curl -k https://cloud.ocis.test/ocs/v1.php/apps/files_sharing/api/v1/shares\?include_tags\=false\&state\=all\&shared_with_me\=true -u marie:radioactivity | wc -c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  719k    0  719k    0     0  65986      0 --:--:--  0:00:11 --:--:--  183k
736536
vscode ➜ ~/repositories/reva (prefer-return-minimal ✗) $ curl -k https://cloud.ocis.test/ocs/v1.php/apps/files_sharing/api/v1/shares\?include_tags\=false\&state\=all\&shared_with_me\=true\&format\=json -u marie:radioactivity | wc -c 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  554k    0  554k    0     0  54360      0 --:--:--  0:00:10 --:--:--  132k
567465

roughly 1/3 the size...

@butonic
Copy link
Member Author

butonic commented Sep 12, 2022

also supported by oc10:

$ curl https://demo.owncloud.com/ocs/v1.php/apps/files_sharing/api/v1/shares\?include_tags\=false\&state\=all\&shared_with_me\=true\&format\=json -u demo:demo                   
{"ocs":{"meta":{"status":"ok","statuscode":100,"message":null,"totalitems":"","itemsperpage":""},"data":[]}}

@kulmann
Copy link
Member

kulmann commented Sep 12, 2022

Would need to add a format param to

_makeOCSrequest (method, service, action, data, authRequired = true) {
, use it in that function for the request and the parsing preference. Then use it in getShares and getShare of the shareManagement.js file. Very straightforward.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants