{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/49661275","id":49661275,"diff_hunk":"@@ -17,7 +17,9 @@ def get_blocks(\n         requested_fields=None,\n         block_counts=None,\n         student_view_data=None,\n-        return_type='dict'\n+        return_type='dict',\n+        block_types=None,","path":"lms/djangoapps/course_api/blocks/api.py","position":6,"original_position":6,"commit_id":"a1c88bda5612f259b280776c68d06759ea2f75dc","original_commit_id":"a1c88bda5612f259b280776c68d06759ea2f75dc","user":{"login":"nasthagiri","id":6772826,"avatar_url":"https://avatars.githubusercontent.com/u/6772826?v=3","gravatar_id":"","url":"https://api.github.com/users/nasthagiri","html_url":"https://github.com/nasthagiri","followers_url":"https://api.github.com/users/nasthagiri/followers","following_url":"https://api.github.com/users/nasthagiri/following{/other_user}","gists_url":"https://api.github.com/users/nasthagiri/gists{/gist_id}","starred_url":"https://api.github.com/users/nasthagiri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nasthagiri/subscriptions","organizations_url":"https://api.github.com/users/nasthagiri/orgs","repos_url":"https://api.github.com/users/nasthagiri/repos","events_url":"https://api.github.com/users/nasthagiri/events{/privacy}","received_events_url":"https://api.github.com/users/nasthagiri/received_events","type":"User","site_admin":false},"body":"The `block_types` parameter is a filter.  To be consistent with other filters implemented in this API, we should introduce a new `BlockTypesFilterTransformer`.  The new transformer would then be processed along with other Blocks API transformers, as done [here](https://github.com/edx/edx-platform/blob/master/lms/djangoapps/course_api/blocks/transformers/blocks_api.py#L60).\r\n\r\nRegarding conflicting with `block_counts`, I don't see it that way.  `block_counts` returns an aggregate count of the number of blocks within each subtree.  Whereas `block_types` is a filter, specifying exactly which types of blocks to return.  It's possible that `block_counts` may contain additional types that are not included in `block_types`.  In that case, the counts for those should still be returned, but the blocks themselves wouldn't.\r\n\r\nIn order to implement it as such, we would order the `block_counts` Transformer *before* the `block_types` Transformer.  Since the latter would filter out blocks before they are counted.","created_at":"2016-01-13T22:30:07Z","updated_at":"2016-01-13T22:30:07Z","html_url":"https://github.com/edx/edx-platform/pull/10951#discussion_r49661275","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/10951","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/49661275"},"html":{"href":"https://github.com/edx/edx-platform/pull/10951#discussion_r49661275"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/10951"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/10951","id":53389259,"html_url":"https://github.com/edx/edx-platform/pull/10951","diff_url":"https://github.com/edx/edx-platform/pull/10951.diff","patch_url":"https://github.com/edx/edx-platform/pull/10951.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/10951","number":10951,"state":"open","locked":false,"title":"New optional parameters for course blocks API: lti_url, block_types","user":{"login":"lenacom","id":7777978,"avatar_url":"https://avatars.githubusercontent.com/u/7777978?v=3","gravatar_id":"","url":"https://api.github.com/users/lenacom","html_url":"https://github.com/lenacom","followers_url":"https://api.github.com/users/lenacom/followers","following_url":"https://api.github.com/users/lenacom/following{/other_user}","gists_url":"https://api.github.com/users/lenacom/gists{/gist_id}","starred_url":"https://api.github.com/users/lenacom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lenacom/subscriptions","organizations_url":"https://api.github.com/users/lenacom/orgs","repos_url":"https://api.github.com/users/lenacom/repos","events_url":"https://api.github.com/users/lenacom/events{/privacy}","received_events_url":"https://api.github.com/users/lenacom/received_events","type":"User","site_admin":false},"body":"**Background:** Business people need to generate a list of LTI URLs for a given course, to provide to a customer. This new request should reduce the time and effort needed to pull LTI endpoints for a course, and reduce the chance of human error. \r\n\r\n**Studio Updates:** None.\r\n\r\n**LMS Updates:** 2 new optional parameters are added to /api/courses/v1/blocks/?course_id=<course_id>: \r\n- 'lti_url' (boolean, indicates if it's required to show the field 'lti_url');\r\n- 'block_types' (a list of requested block types; possible values include sequential, vertical, html, problem, video, and discussion). \r\n\r\n**Manual test instructions:**\r\nOpen in the browser:\r\nhttp://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course&username=staff&depth=all&block_counts=video&lti_url=true&block_types=html,video\r\n![edx23](https://cloud.githubusercontent.com/assets/7777978/12007611/bb5b91d4-ac1c-11e5-8eb3-775f2dedd084.jpg)\r\n\r\n\r\n\r\n","created_at":"2015-12-11T12:54:14Z","updated_at":"2016-01-13T22:30:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99404055d00f934cca045990fe7f86a1cb0e8db4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/10951/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/10951/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/10951/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/a1c88bda5612f259b280776c68d06759ea2f75dc","head":{"label":"CredoReference:feature/edx-23","ref":"feature/edx-23","sha":"a1c88bda5612f259b280776c68d06759ea2f75dc","user":{"login":"CredoReference","id":15221069,"avatar_url":"https://avatars.githubusercontent.com/u/15221069?v=3","gravatar_id":"","url":"https://api.github.com/users/CredoReference","html_url":"https://github.com/CredoReference","followers_url":"https://api.github.com/users/CredoReference/followers","following_url":"https://api.github.com/users/CredoReference/following{/other_user}","gists_url":"https://api.github.com/users/CredoReference/gists{/gist_id}","starred_url":"https://api.github.com/users/CredoReference/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CredoReference/subscriptions","organizations_url":"https://api.github.com/users/CredoReference/orgs","repos_url":"https://api.github.com/users/CredoReference/repos","events_url":"https://api.github.com/users/CredoReference/events{/privacy}","received_events_url":"https://api.github.com/users/CredoReference/received_events","type":"Organization","site_admin":false},"repo":{"id":44635152,"name":"edx-platform","full_name":"CredoReference/edx-platform","owner":{"login":"CredoReference","id":15221069,"avatar_url":"https://avatars.githubusercontent.com/u/15221069?v=3","gravatar_id":"","url":"https://api.github.com/users/CredoReference","html_url":"https://github.com/CredoReference","followers_url":"https://api.github.com/users/CredoReference/followers","following_url":"https://api.github.com/users/CredoReference/following{/other_user}","gists_url":"https://api.github.com/users/CredoReference/gists{/gist_id}","starred_url":"https://api.github.com/users/CredoReference/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CredoReference/subscriptions","organizations_url":"https://api.github.com/users/CredoReference/orgs","repos_url":"https://api.github.com/users/CredoReference/repos","events_url":"https://api.github.com/users/CredoReference/events{/privacy}","received_events_url":"https://api.github.com/users/CredoReference/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CredoReference/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":true,"url":"https://api.github.com/repos/CredoReference/edx-platform","forks_url":"https://api.github.com/repos/CredoReference/edx-platform/forks","keys_url":"https://api.github.com/repos/CredoReference/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CredoReference/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CredoReference/edx-platform/teams","hooks_url":"https://api.github.com/repos/CredoReference/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/CredoReference/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/CredoReference/edx-platform/events","assignees_url":"https://api.github.com/repos/CredoReference/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/CredoReference/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/CredoReference/edx-platform/tags","blobs_url":"https://api.github.com/repos/CredoReference/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CredoReference/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CredoReference/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/CredoReference/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CredoReference/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/CredoReference/edx-platform/languages","stargazers_url":"https://api.github.com/repos/CredoReference/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/CredoReference/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/CredoReference/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/CredoReference/edx-platform/subscription","commits_url":"https://api.github.com/repos/CredoReference/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/CredoReference/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/CredoReference/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/CredoReference/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/CredoReference/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/CredoReference/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CredoReference/edx-platform/merges","archive_url":"https://api.github.com/repos/CredoReference/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CredoReference/edx-platform/downloads","issues_url":"https://api.github.com/repos/CredoReference/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/CredoReference/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/CredoReference/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/CredoReference/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CredoReference/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/CredoReference/edx-platform/releases{/id}","created_at":"2015-10-20T21:10:15Z","updated_at":"2015-10-20T21:11:16Z","pushed_at":"2016-01-13T15:52:24Z","git_url":"git://github.com/CredoReference/edx-platform.git","ssh_url":"git@github.com:CredoReference/edx-platform.git","clone_url":"https://github.com/CredoReference/edx-platform.git","svn_url":"https://github.com/CredoReference/edx-platform","homepage":"http://open.edx.org/","size":570189,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"6d5047ef128e404a9d9aecc0e686d7787d541718","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-01-13T17:03:31Z","pushed_at":"2016-01-13T22:28:44Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":641725,"stargazers_count":2344,"watchers_count":2344,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1428,"mirror_url":null,"open_issues_count":142,"forks":1428,"open_issues":142,"watchers":2344,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/10951"},"html":{"href":"https://github.com/edx/edx-platform/pull/10951"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/10951"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/10951/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/10951/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/10951/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/a1c88bda5612f259b280776c68d06759ea2f75dc"}}}}