{"action":"created","issue":{"url":"https://api.github.com/repos/cyverse-de/terrain/issues/8","repository_url":"https://api.github.com/repos/cyverse-de/terrain","labels_url":"https://api.github.com/repos/cyverse-de/terrain/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/cyverse-de/terrain/issues/8/comments","events_url":"https://api.github.com/repos/cyverse-de/terrain/issues/8/events","html_url":"https://github.com/cyverse-de/terrain/pull/8","id":188360211,"number":8,"title":"CORE-7813 Reorganize /secured/bootstrap response","user":{"login":"psarando","id":996408,"avatar_url":"https://avatars.githubusercontent.com/u/996408?v=3","gravatar_id":"","url":"https://api.github.com/users/psarando","html_url":"https://github.com/psarando","followers_url":"https://api.github.com/users/psarando/followers","following_url":"https://api.github.com/users/psarando/following{/other_user}","gists_url":"https://api.github.com/users/psarando/gists{/gist_id}","starred_url":"https://api.github.com/users/psarando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psarando/subscriptions","organizations_url":"https://api.github.com/users/psarando/orgs","repos_url":"https://api.github.com/users/psarando/repos","events_url":"https://api.github.com/users/psarando/events{/privacy}","received_events_url":"https://api.github.com/users/psarando/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-09T21:44:11Z","updated_at":"2016-11-16T20:12:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cyverse-de/terrain/pulls/8","html_url":"https://github.com/cyverse-de/terrain/pull/8","diff_url":"https://github.com/cyverse-de/terrain/pull/8.diff","patch_url":"https://github.com/cyverse-de/terrain/pull/8.patch"},"body":"The current `GET /secured/bootstrap` endpoint response has the following structure:\r\n```json\r\n{\r\n    \"loginTime\": \"1374190755304\",\r\n    \"newWorkspace\": false,\r\n    \"workspaceId\": \"4\",\r\n    \"username\": \"snow-dog\",\r\n    \"full_username\": \"snow-dog@iplantcollaborative.org\",\r\n    \"email\": \"sd@example.org\",\r\n    \"firstName\": \"Snow\",\r\n    \"lastName\": \"Dog\",\r\n    \"userHomePath\": \"/iplant/home/snow-dog\",\r\n    \"userTrashPath\": \"/iplant/trash/snow-dog\",\r\n    \"baseTrashPath\": \"/iplant/trash\",\r\n    \"preferences\": {\r\n        \"systemDefaultOutputDir\": {\r\n            \"id\": \"/iplant/home/snow-dog/analyses\",\r\n            \"path\": \"/iplant/home/snow-dog/analyses\"\r\n        },\r\n        \"defaultOutputFolder\": {\r\n            \"id\": \"/iplant/home/snow-dog/analyses\",\r\n            \"path\": \"/iplant/home/snow-dog/analyses\"\r\n        }\r\n    },\r\n    \"auth-redirect\": {\r\n        \"example\": \"https://example.org\"\r\n    }\r\n}\r\n```\r\n\r\nThese fields are pieced together from 3 different services other than terrain (apps, data-info, and preferences).\r\n\r\nIt would be helpful to group the info of each service under its own field, similar to the existing `preferences` field. Then if a service is down, rather than this terrain endpoint immediately throwing an error that prevents the UI from loading, the field that should contain that service's info will contain the error response instead. This will allow the UI to finish loading, with partial user info, and could also help the UI determine which service is down from the initial bootstrap endpoint response.\r\n\r\nSince the response format is getting updated, the JSON keys can also be converted from camel-case to underscores (snake-case), which is more standard in our other endpoints.\r\n\r\nFor example:\r\n```json\r\n{\r\n  \"user_info\": {\r\n    \"username\": \"snow-dog\",\r\n    \"full_username\": \"snow-dog@iplantcollaborative.org\",\r\n    \"email\": \"sd@example.org\",\r\n    \"first_name\": \"Snow\",\r\n    \"last_name\": \"Dog\"\r\n  },\r\n  \"session\": {\r\n    \"login_time\": 1374190755304,\r\n    \"auth_redirect\": {\r\n      \"example\": \"https://example.org\"\r\n    }\r\n  },\r\n  \"workspace\": {\r\n    \"new_workspace\": false,\r\n    \"workspace_id\": \"4\"\r\n  },\r\n  \"data_info\": {\r\n    \"user_home_path\": \"/iplant/home/snow-dog\",\r\n    \"user_trash_path\": \"/iplant/trash/snow-dog\",\r\n    \"base_trash_path\": \"/iplant/trash\"\r\n  },\r\n  \"preferences\": {\r\n    \"system_default_output_dir\": {\r\n      \"id\": \"/iplant/home/snow-dog/analyses\",\r\n      \"path\": \"/iplant/home/snow-dog/analyses\"\r\n    },\r\n    \"default_output_folder\": {\r\n      \"id\": \"/iplant/home/snow-dog/analyses\",\r\n      \"path\": \"/iplant/home/snow-dog/analyses\"\r\n    }\r\n  }\r\n}\r\n```\r\nThen if these services (besides terrain) are down, the bootstrap endpoint can still return success to the UI, but provide an error message letting the UI know which services are down or inaccessible.\r\n\r\nFor example:\r\n```json\r\n{\r\n  \"user_info\": {\r\n    \"username\": \"snow-dog\",\r\n    \"full_username\": \"snow-dog@iplantcollaborative.org\",\r\n    \"email\": \"sd@example.org\",\r\n    \"first_name\": \"Snow\",\r\n    \"last_name\": \"Dog\"\r\n  },\r\n  \"session\": {\r\n    \"error\": \"java.net.ConnectException: Connection refused\"\r\n  },\r\n  \"workspace\": {\r\n    \"status\": 400,\r\n    \"error\": {\r\n      \"error_code\": \"ERR_ILLEGAL_ARGUMENT\",\r\n      \"reason\": {\r\n        \"foo\": \"disallowed-key\"\r\n      }\r\n    }\r\n  },\r\n  \"data_info\": {\r\n    \"status\": 404,\r\n    \"error\": {\r\n      \"success\": false,\r\n      \"reason\": \"unrecognized service path\"\r\n    }\r\n  },\r\n  \"preferences\": {\r\n    \"status\": 503,\r\n    \"error\": \"<html>\\r\\n<head><title>503 Service Unavailable</title></head>\\r\\n<body bgcolor=\\\"white\\\">\\r\\n<center><h1>503 Service Unavailable</h1></center>\\r\\n<hr><center>nginx/1.11.4</center>\\r\\n</body>\\r\\n</html>\\r\\n\"\r\n  }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/cyverse-de/terrain/issues/comments/261058161","html_url":"https://github.com/cyverse-de/terrain/pull/8#issuecomment-261058161","issue_url":"https://api.github.com/repos/cyverse-de/terrain/issues/8","id":261058161,"user":{"login":"ianmcorvidae","id":106004,"avatar_url":"https://avatars.githubusercontent.com/u/106004?v=3","gravatar_id":"","url":"https://api.github.com/users/ianmcorvidae","html_url":"https://github.com/ianmcorvidae","followers_url":"https://api.github.com/users/ianmcorvidae/followers","following_url":"https://api.github.com/users/ianmcorvidae/following{/other_user}","gists_url":"https://api.github.com/users/ianmcorvidae/gists{/gist_id}","starred_url":"https://api.github.com/users/ianmcorvidae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianmcorvidae/subscriptions","organizations_url":"https://api.github.com/users/ianmcorvidae/orgs","repos_url":"https://api.github.com/users/ianmcorvidae/repos","events_url":"https://api.github.com/users/ianmcorvidae/events{/privacy}","received_events_url":"https://api.github.com/users/ianmcorvidae/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T20:12:55Z","updated_at":"2016-11-16T20:12:55Z","body":"Just a couple comments in advance of any design discussioning we might do about this:\r\n\r\n* The nginx error page responses can be modified. It should therefore not be an issue to make the 503 more consistent, we just have to put in in place. I've been wanting to do this anyway\r\n* I'd love to standardize the JSON to some extent, but we should also have some amount of \"add some arbitrary keys somewhere\" ability -- not every detail we want to pass in an error is going to be formally defined, so an arbitrary object somewhere in the format would be good. Most stuff should be standardizable though, e.g. reasons etc."}}
{"actor":{"display_login":"ianmcorvidae"}}