{"action":"created","issue":{"url":"https://api.github.com/repos/cfpb/hmda-platform/issues/719","repository_url":"https://api.github.com/repos/cfpb/hmda-platform","labels_url":"https://api.github.com/repos/cfpb/hmda-platform/issues/719/labels{/name}","comments_url":"https://api.github.com/repos/cfpb/hmda-platform/issues/719/comments","events_url":"https://api.github.com/repos/cfpb/hmda-platform/issues/719/events","html_url":"https://github.com/cfpb/hmda-platform/issues/719","id":193553970,"number":719,"title":"Add pagination to endpoints","user":{"login":"awolfe76","id":2932572,"avatar_url":"https://avatars.githubusercontent.com/u/2932572?v=3","gravatar_id":"","url":"https://api.github.com/users/awolfe76","html_url":"https://github.com/awolfe76","followers_url":"https://api.github.com/users/awolfe76/followers","following_url":"https://api.github.com/users/awolfe76/following{/other_user}","gists_url":"https://api.github.com/users/awolfe76/gists{/gist_id}","starred_url":"https://api.github.com/users/awolfe76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awolfe76/subscriptions","organizations_url":"https://api.github.com/users/awolfe76/orgs","repos_url":"https://api.github.com/users/awolfe76/repos","events_url":"https://api.github.com/users/awolfe76/events{/privacy}","received_events_url":"https://api.github.com/users/awolfe76/received_events","type":"User","site_admin":false},"labels":[{"id":318539567,"url":"https://api.github.com/repos/cfpb/hmda-platform/labels/Data%20Validation","name":"Data Validation","color":"5319e7","default":false},{"id":318539955,"url":"https://api.github.com/repos/cfpb/hmda-platform/labels/File%20Submission","name":"File Submission","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-05T17:02:34Z","updated_at":"2016-12-06T19:17:20Z","closed_at":null,"body":"See https://github.com/cfpb/hmda-platform-ui/issues/274\r\n\r\nWe'll need pagination on a few endpoints:\r\n- `/institutions/<institution>/filings/<period>/submissions/<submissionId>/edits/<syntactical|validity|quality|macro>`\r\n- `/institutions/<institution>/filings/<period>/submissions/<submissionId>/irs`\r\n- `/institutions/<institution>/filings/<period>/submissions/<submissionId>/parseErrors`\r\n\r\nThere are a few ways to handle this but a _possible_ addition to the responses could be, using `/institutions/<institution>/filings/<period>/submissions/<submissionId>/edits/syntactical` as an example:\r\n```json\r\n\"_links\": {\r\n  \"self\": \".../edits/syntactical?page=3\",\r\n  \"first\": \".../edits/syntactical\",\r\n  \"prev\": \".../edits/syntactical?page=2\",\r\n  \"next\": \".../edits/syntactical?page=4\",\r\n  \"last\": \".../edits/syntactical?page=53\"\r\n},\r\n\"count\": 20,\r\n\"total\": 1054\r\n```\r\n\r\nWe could also add a `?limit=x` parameter but I'm not sure we need to yet. I think the default should be 20 but happy to hear otherwise. (I'm just saying 20 ... not much thought behind it.)\r\n\r\n`/institutions/<institution>/filings/<period>/submissions/<submissionId>/edits` probably doesn't need pagination but should probably return only the first 20 edits for each edit type."},"comment":{"url":"https://api.github.com/repos/cfpb/hmda-platform/issues/comments/265244517","html_url":"https://github.com/cfpb/hmda-platform/issues/719#issuecomment-265244517","issue_url":"https://api.github.com/repos/cfpb/hmda-platform/issues/719","id":265244517,"user":{"login":"nickgrippin","id":19194939,"avatar_url":"https://avatars.githubusercontent.com/u/19194939?v=3","gravatar_id":"","url":"https://api.github.com/users/nickgrippin","html_url":"https://github.com/nickgrippin","followers_url":"https://api.github.com/users/nickgrippin/followers","following_url":"https://api.github.com/users/nickgrippin/following{/other_user}","gists_url":"https://api.github.com/users/nickgrippin/gists{/gist_id}","starred_url":"https://api.github.com/users/nickgrippin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickgrippin/subscriptions","organizations_url":"https://api.github.com/users/nickgrippin/orgs","repos_url":"https://api.github.com/users/nickgrippin/repos","events_url":"https://api.github.com/users/nickgrippin/events{/privacy}","received_events_url":"https://api.github.com/users/nickgrippin/received_events","type":"User","site_admin":false},"created_at":"2016-12-06T19:17:20Z","updated_at":"2016-12-06T19:17:20Z","body":"I can understand the design pattern here, and see how it would be used.\r\n\r\nMy question is: why would we want the back-end to be responsible for pagination?  It seems like a much simpler (and quicker) solution to have the front-end to request the entire data set and just present each subset, advancing when the user clicks `next`.  This way, we avoid excessive API calls and the longer load times while waiting for each call to finish."}}
{"actor":{"display_login":"nickgrippin"}}