{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/18769","labels_url":"https://api.github.com/repos/owncloud/core/issues/18769/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/18769/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/18769/events","html_url":"https://github.com/owncloud/core/pull/18769","id":104471016,"number":18769,"title":"ETags for OCS responses","user":{"login":"rullzer","id":45821,"avatar_url":"https://avatars.githubusercontent.com/u/45821?v=3","gravatar_id":"","url":"https://api.github.com/users/rullzer","html_url":"https://github.com/rullzer","followers_url":"https://api.github.com/users/rullzer/followers","following_url":"https://api.github.com/users/rullzer/following{/other_user}","gists_url":"https://api.github.com/users/rullzer/gists{/gist_id}","starred_url":"https://api.github.com/users/rullzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rullzer/subscriptions","organizations_url":"https://api.github.com/users/rullzer/orgs","repos_url":"https://api.github.com/users/rullzer/repos","events_url":"https://api.github.com/users/rullzer/events{/privacy}","received_events_url":"https://api.github.com/users/rullzer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/dev:ocs","name":"dev:ocs","color":"FF9966"},{"url":"https://api.github.com/repos/owncloud/core/labels/enhancement","name":"enhancement","color":"02e10c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-09-02T12:35:20Z","updated_at":"2015-11-10T09:30:08Z","closed_at":"2015-11-10T09:24:47Z","pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/18769","html_url":"https://github.com/owncloud/core/pull/18769","diff_url":"https://github.com/owncloud/core/pull/18769.diff","patch_url":"https://github.com/owncloud/core/pull/18769.patch"},"body":"This commit adds ETags to OCS responses. The ETag is just the md5sum of the body of the response.\r\nWhich means that we can now also return a 304 when nothing has changed.\r\n\r\nThis will allow clients to efficiently check for updates.\r\nFor example in: https://github.com/owncloud/core/issues/6813#issuecomment-137012278\r\n\r\nThere is no way to properly test this as far as I know on the phpunit runs.\r\nBut we should add sets for it in the smashbox tests.\r\n\r\n## Steps to test\r\n\r\n1. Get your list of current shares via\r\n```curl -u USER:PASS -D - 'https://cloud2.famdouma.nl//ocs/v1.php/apps/files_sharing/api/v1/shares'```\r\n2. Get the Etag ( for example ETag: \"abc\")\r\n3. Request the list of shares again with the IF_NONE_MATCH header:\r\n```curl -u USER:PASS -D - 'https://cloud2.famdouma.nl//ocs/v1.php/apps/files_sharing/api/v1/shares' --header 'If-None-Match: \"abc\"'```\r\n4. Add/remove a new share\r\n5. Request the list of shares again:\r\n```curl -u USER:PASS -D - 'https://cloud2.famdouma.nl//ocs/v1.php/apps/files_sharing/api/v1/shares' --header 'If-None-Match: \"abc\"'```\r\n\r\n#### Before\r\n\r\nThere is no etag in step 2. And the whole response is send each time\r\n\r\n#### After\r\n\r\nStep 3 will return a 304. Telling you that nothing has changed.\r\nStep 5 will return the new response and a new ETag.\r\n\r\n\r\n## Notice\r\n\r\nThe ETag only here only checks the content. So the only thing you know is that the response is the same as before. You do not know that nothing happend.\r\n\r\nFor example.\r\n\r\n1. Request shares (and get ETag)\r\n2. Add share X\r\n3. Remove share X\r\n4. Request share with IF_NONE_MATCH\r\n\r\nStep 4 will return a 304. Which is what you want actually :)\r\n\r\n\r\nCC: @PVince81 @Raydiation @Xenopathic @MorrisJobke @DeepDiver1975 @LukasReschke "},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/155368070","html_url":"https://github.com/owncloud/core/pull/18769#issuecomment-155368070","issue_url":"https://api.github.com/repos/owncloud/core/issues/18769","id":155368070,"user":{"login":"DeepDiver1975","id":1005065,"avatar_url":"https://avatars.githubusercontent.com/u/1005065?v=3","gravatar_id":"","url":"https://api.github.com/users/DeepDiver1975","html_url":"https://github.com/DeepDiver1975","followers_url":"https://api.github.com/users/DeepDiver1975/followers","following_url":"https://api.github.com/users/DeepDiver1975/following{/other_user}","gists_url":"https://api.github.com/users/DeepDiver1975/gists{/gist_id}","starred_url":"https://api.github.com/users/DeepDiver1975/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeepDiver1975/subscriptions","organizations_url":"https://api.github.com/users/DeepDiver1975/orgs","repos_url":"https://api.github.com/users/DeepDiver1975/repos","events_url":"https://api.github.com/users/DeepDiver1975/events{/privacy}","received_events_url":"https://api.github.com/users/DeepDiver1975/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T09:30:08Z","updated_at":"2015-11-10T09:30:08Z","body":"THX @rullzer "}}