{"action":"created","comment":{"url":"https://api.github.com/repos/girder/girder/pulls/comments/144112860","pull_request_review_id":68724699,"id":144112860,"diff_hunk":"@@ -239,6 +239,37 @@ classes, and we can add it to the API in the ``load()`` method.\n     def load(info):\n         info['apiRoot'].cat = Cat()\n \n+Adding a prefix to an API\n+*************************\n+\n+It is possible to provide a prefix to your API, allowing associate endpoints to","path":"docs/plugin-development.rst","position":7,"original_position":7,"commit_id":"093e1b8af9e708841a75a88a8079e7d7514ccbcc","original_commit_id":"093e1b8af9e708841a75a88a8079e7d7514ccbcc","user":{"login":"zachmullen","id":555959,"avatar_url":"https://avatars1.githubusercontent.com/u/555959?v=4","gravatar_id":"","url":"https://api.github.com/users/zachmullen","html_url":"https://github.com/zachmullen","followers_url":"https://api.github.com/users/zachmullen/followers","following_url":"https://api.github.com/users/zachmullen/following{/other_user}","gists_url":"https://api.github.com/users/zachmullen/gists{/gist_id}","starred_url":"https://api.github.com/users/zachmullen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachmullen/subscriptions","organizations_url":"https://api.github.com/users/zachmullen/orgs","repos_url":"https://api.github.com/users/zachmullen/repos","events_url":"https://api.github.com/users/zachmullen/events{/privacy}","received_events_url":"https://api.github.com/users/zachmullen/received_events","type":"User","site_admin":false},"body":"associated*","created_at":"2017-10-11T19:32:06Z","updated_at":"2017-10-11T19:32:06Z","html_url":"https://github.com/girder/girder/pull/2395#discussion_r144112860","pull_request_url":"https://api.github.com/repos/girder/girder/pulls/2395","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/girder/girder/pulls/comments/144112860"},"html":{"href":"https://github.com/girder/girder/pull/2395#discussion_r144112860"},"pull_request":{"href":"https://api.github.com/repos/girder/girder/pulls/2395"}}},"pull_request":{"url":"https://api.github.com/repos/girder/girder/pulls/2395","id":145696043,"html_url":"https://github.com/girder/girder/pull/2395","diff_url":"https://github.com/girder/girder/pull/2395.diff","patch_url":"https://github.com/girder/girder/pull/2395.patch","issue_url":"https://api.github.com/repos/girder/girder/issues/2395","number":2395,"state":"open","locked":false,"title":"Allow endpoints to be mounted at a prefix","user":{"login":"cjh1","id":1031053,"avatar_url":"https://avatars3.githubusercontent.com/u/1031053?v=4","gravatar_id":"","url":"https://api.github.com/users/cjh1","html_url":"https://github.com/cjh1","followers_url":"https://api.github.com/users/cjh1/followers","following_url":"https://api.github.com/users/cjh1/following{/other_user}","gists_url":"https://api.github.com/users/cjh1/gists{/gist_id}","starred_url":"https://api.github.com/users/cjh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjh1/subscriptions","organizations_url":"https://api.github.com/users/cjh1/orgs","repos_url":"https://api.github.com/users/cjh1/repos","events_url":"https://api.github.com/users/cjh1/events{/privacy}","received_events_url":"https://api.github.com/users/cjh1/received_events","type":"User","site_admin":false},"body":"@zachmullen This is what I came up with. This is not a breaking change, I believe. \r\n\r\nBasically it allows a Resource instance to be passed into route(...). We then generate a mapping of Resource instance to mounted paths. We use this mounted path when generating the swagger doc. So you can mount a resource at a prefix like this:\r\n\r\nWhen defining your routes you need to pass in self as the resource:\r\n```python\r\nself.route('POST', (), self.create_tomo, resource=self)\r\n```\r\n\r\nThen the resource can be mounted at a prefix like this:\r\n```python\r\ninfo['apiRoot'].test = Prefix()\r\ninfo['apiRoot'].test.myresource =  Resource()\r\n```\r\nWe could get more magical and remove the need for explicit creation of the prefix, but I'm not sure that is a good idea.\r\n\r\nAs a follow up to this I think we should add a breaking change in Girder 3 to make the Resource instance the default for the resource parameter [here](https://github.com/girder/girder/blob/master/girder/api/rest.py#L780). Then we can depreciate the use of resourceName ...\r\n\r\nIf this looks OK, will add a test or two.","created_at":"2017-10-10T13:42:42Z","updated_at":"2017-10-11T19:32:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fcbe6988b5a83f08201c52983c9c64184ec3195","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/girder/girder/pulls/2395/commits","review_comments_url":"https://api.github.com/repos/girder/girder/pulls/2395/comments","review_comment_url":"https://api.github.com/repos/girder/girder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/girder/girder/issues/2395/comments","statuses_url":"https://api.github.com/repos/girder/girder/statuses/093e1b8af9e708841a75a88a8079e7d7514ccbcc","head":{"label":"girder:prefix","ref":"prefix","sha":"093e1b8af9e708841a75a88a8079e7d7514ccbcc","user":{"login":"girder","id":5150517,"avatar_url":"https://avatars2.githubusercontent.com/u/5150517?v=4","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"repo":{"id":11854950,"name":"girder","full_name":"girder/girder","owner":{"login":"girder","id":5150517,"avatar_url":"https://avatars2.githubusercontent.com/u/5150517?v=4","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/girder/girder","description":"A data management platform for the web, developed by Kitware","fork":false,"url":"https://api.github.com/repos/girder/girder","forks_url":"https://api.github.com/repos/girder/girder/forks","keys_url":"https://api.github.com/repos/girder/girder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/girder/girder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/girder/girder/teams","hooks_url":"https://api.github.com/repos/girder/girder/hooks","issue_events_url":"https://api.github.com/repos/girder/girder/issues/events{/number}","events_url":"https://api.github.com/repos/girder/girder/events","assignees_url":"https://api.github.com/repos/girder/girder/assignees{/user}","branches_url":"https://api.github.com/repos/girder/girder/branches{/branch}","tags_url":"https://api.github.com/repos/girder/girder/tags","blobs_url":"https://api.github.com/repos/girder/girder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/girder/girder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/girder/girder/git/refs{/sha}","trees_url":"https://api.github.com/repos/girder/girder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/girder/girder/statuses/{sha}","languages_url":"https://api.github.com/repos/girder/girder/languages","stargazers_url":"https://api.github.com/repos/girder/girder/stargazers","contributors_url":"https://api.github.com/repos/girder/girder/contributors","subscribers_url":"https://api.github.com/repos/girder/girder/subscribers","subscription_url":"https://api.github.com/repos/girder/girder/subscription","commits_url":"https://api.github.com/repos/girder/girder/commits{/sha}","git_commits_url":"https://api.github.com/repos/girder/girder/git/commits{/sha}","comments_url":"https://api.github.com/repos/girder/girder/comments{/number}","issue_comment_url":"https://api.github.com/repos/girder/girder/issues/comments{/number}","contents_url":"https://api.github.com/repos/girder/girder/contents/{+path}","compare_url":"https://api.github.com/repos/girder/girder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/girder/girder/merges","archive_url":"https://api.github.com/repos/girder/girder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/girder/girder/downloads","issues_url":"https://api.github.com/repos/girder/girder/issues{/number}","pulls_url":"https://api.github.com/repos/girder/girder/pulls{/number}","milestones_url":"https://api.github.com/repos/girder/girder/milestones{/number}","notifications_url":"https://api.github.com/repos/girder/girder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/girder/girder/labels{/name}","releases_url":"https://api.github.com/repos/girder/girder/releases{/id}","deployments_url":"https://api.github.com/repos/girder/girder/deployments","created_at":"2013-08-02T23:55:54Z","updated_at":"2017-10-10T12:34:02Z","pushed_at":"2017-10-11T18:30:03Z","git_url":"git://github.com/girder/girder.git","ssh_url":"git@github.com:girder/girder.git","clone_url":"https://github.com/girder/girder.git","svn_url":"https://github.com/girder/girder","homepage":"http://girder.readthedocs.io","size":14410,"stargazers_count":151,"watchers_count":151,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":260,"forks":73,"open_issues":260,"watchers":151,"default_branch":"master"}},"base":{"label":"girder:master","ref":"master","sha":"c0f4bf0a47e0eb54baff28cf00a2744a88adef3c","user":{"login":"girder","id":5150517,"avatar_url":"https://avatars2.githubusercontent.com/u/5150517?v=4","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"repo":{"id":11854950,"name":"girder","full_name":"girder/girder","owner":{"login":"girder","id":5150517,"avatar_url":"https://avatars2.githubusercontent.com/u/5150517?v=4","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/girder/girder","description":"A data management platform for the web, developed by Kitware","fork":false,"url":"https://api.github.com/repos/girder/girder","forks_url":"https://api.github.com/repos/girder/girder/forks","keys_url":"https://api.github.com/repos/girder/girder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/girder/girder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/girder/girder/teams","hooks_url":"https://api.github.com/repos/girder/girder/hooks","issue_events_url":"https://api.github.com/repos/girder/girder/issues/events{/number}","events_url":"https://api.github.com/repos/girder/girder/events","assignees_url":"https://api.github.com/repos/girder/girder/assignees{/user}","branches_url":"https://api.github.com/repos/girder/girder/branches{/branch}","tags_url":"https://api.github.com/repos/girder/girder/tags","blobs_url":"https://api.github.com/repos/girder/girder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/girder/girder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/girder/girder/git/refs{/sha}","trees_url":"https://api.github.com/repos/girder/girder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/girder/girder/statuses/{sha}","languages_url":"https://api.github.com/repos/girder/girder/languages","stargazers_url":"https://api.github.com/repos/girder/girder/stargazers","contributors_url":"https://api.github.com/repos/girder/girder/contributors","subscribers_url":"https://api.github.com/repos/girder/girder/subscribers","subscription_url":"https://api.github.com/repos/girder/girder/subscription","commits_url":"https://api.github.com/repos/girder/girder/commits{/sha}","git_commits_url":"https://api.github.com/repos/girder/girder/git/commits{/sha}","comments_url":"https://api.github.com/repos/girder/girder/comments{/number}","issue_comment_url":"https://api.github.com/repos/girder/girder/issues/comments{/number}","contents_url":"https://api.github.com/repos/girder/girder/contents/{+path}","compare_url":"https://api.github.com/repos/girder/girder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/girder/girder/merges","archive_url":"https://api.github.com/repos/girder/girder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/girder/girder/downloads","issues_url":"https://api.github.com/repos/girder/girder/issues{/number}","pulls_url":"https://api.github.com/repos/girder/girder/pulls{/number}","milestones_url":"https://api.github.com/repos/girder/girder/milestones{/number}","notifications_url":"https://api.github.com/repos/girder/girder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/girder/girder/labels{/name}","releases_url":"https://api.github.com/repos/girder/girder/releases{/id}","deployments_url":"https://api.github.com/repos/girder/girder/deployments","created_at":"2013-08-02T23:55:54Z","updated_at":"2017-10-10T12:34:02Z","pushed_at":"2017-10-11T18:30:03Z","git_url":"git://github.com/girder/girder.git","ssh_url":"git@github.com:girder/girder.git","clone_url":"https://github.com/girder/girder.git","svn_url":"https://github.com/girder/girder","homepage":"http://girder.readthedocs.io","size":14410,"stargazers_count":151,"watchers_count":151,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":260,"forks":73,"open_issues":260,"watchers":151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/girder/girder/pulls/2395"},"html":{"href":"https://github.com/girder/girder/pull/2395"},"issue":{"href":"https://api.github.com/repos/girder/girder/issues/2395"},"comments":{"href":"https://api.github.com/repos/girder/girder/issues/2395/comments"},"review_comments":{"href":"https://api.github.com/repos/girder/girder/pulls/2395/comments"},"review_comment":{"href":"https://api.github.com/repos/girder/girder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/girder/girder/pulls/2395/commits"},"statuses":{"href":"https://api.github.com/repos/girder/girder/statuses/093e1b8af9e708841a75a88a8079e7d7514ccbcc"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"zachmullen"}}