{"action":"closed","issue":{"url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/114","repository_url":"https://api.github.com/repos/ibm-watson-iot/iot-java","labels_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/114/comments","events_url":"https://api.github.com/repos/ibm-watson-iot/iot-java/issues/114/events","html_url":"https://github.com/ibm-watson-iot/iot-java/issues/114","id":285390818,"number":114,"title":"API client does not provide reason from API result","user":{"login":"slaupster","id":9283885,"avatar_url":"https://avatars2.githubusercontent.com/u/9283885?v=4","gravatar_id":"","url":"https://api.github.com/users/slaupster","html_url":"https://github.com/slaupster","followers_url":"https://api.github.com/users/slaupster/followers","following_url":"https://api.github.com/users/slaupster/following{/other_user}","gists_url":"https://api.github.com/users/slaupster/gists{/gist_id}","starred_url":"https://api.github.com/users/slaupster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slaupster/subscriptions","organizations_url":"https://api.github.com/users/slaupster/orgs","repos_url":"https://api.github.com/users/slaupster/repos","events_url":"https://api.github.com/users/slaupster/events{/privacy}","received_events_url":"https://api.github.com/users/slaupster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"amitmangalvedkar","id":5586992,"avatar_url":"https://avatars1.githubusercontent.com/u/5586992?v=4","gravatar_id":"","url":"https://api.github.com/users/amitmangalvedkar","html_url":"https://github.com/amitmangalvedkar","followers_url":"https://api.github.com/users/amitmangalvedkar/followers","following_url":"https://api.github.com/users/amitmangalvedkar/following{/other_user}","gists_url":"https://api.github.com/users/amitmangalvedkar/gists{/gist_id}","starred_url":"https://api.github.com/users/amitmangalvedkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitmangalvedkar/subscriptions","organizations_url":"https://api.github.com/users/amitmangalvedkar/orgs","repos_url":"https://api.github.com/users/amitmangalvedkar/repos","events_url":"https://api.github.com/users/amitmangalvedkar/events{/privacy}","received_events_url":"https://api.github.com/users/amitmangalvedkar/received_events","type":"User","site_admin":false},"assignees":[{"login":"amitmangalvedkar","id":5586992,"avatar_url":"https://avatars1.githubusercontent.com/u/5586992?v=4","gravatar_id":"","url":"https://api.github.com/users/amitmangalvedkar","html_url":"https://github.com/amitmangalvedkar","followers_url":"https://api.github.com/users/amitmangalvedkar/followers","following_url":"https://api.github.com/users/amitmangalvedkar/following{/other_user}","gists_url":"https://api.github.com/users/amitmangalvedkar/gists{/gist_id}","starred_url":"https://api.github.com/users/amitmangalvedkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitmangalvedkar/subscriptions","organizations_url":"https://api.github.com/users/amitmangalvedkar/orgs","repos_url":"https://api.github.com/users/amitmangalvedkar/repos","events_url":"https://api.github.com/users/amitmangalvedkar/events{/privacy}","received_events_url":"https://api.github.com/users/amitmangalvedkar/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-01-02T09:55:47Z","updated_at":"2018-02-16T10:56:39Z","closed_at":"2018-02-16T10:56:39Z","author_association":"CONTRIBUTOR","body":"The APIClient provides a generic reason for any failure when constructing Exceptions, instead of passing in a reason if available from the result itself.  For example:\r\n\r\nhttps://github.com/ibm-watson-iot/iot-java/blob/master/src/main/java/com/ibm/iotf/client/api/APIClient.java#L1641\r\n\r\nCreates an Exception with reason text:\r\n\r\n\"Invalid request (No body, invalid JSON, unexpected key, bad value)\"\r\n\r\nwhen actually the reason from the result of the API call is:\r\n\r\n```{\r\n\"violations\": [\r\n  {\r\n\"message\": \"CUDRS0053E: The authToken field was not a valid password. The password must be between 8 and 36 characters long (inclusive). The password must consist only of alpha-numerical characters plus hyphen ( - ), underscore ( _ ) or period ( . ).\",\r\n\"exception\": {\r\n\"id\": \"CUDRS0053E\",\r\n\"properties\": [\r\n  \"authToken\"\r\n],\r\n}\r\n}\r\n],\r\n\"message\": \"CUDRS0007E: The request was not valid. Review the constraint violations provided.\",\r\n\"exception\": {\r\n\"id\": \"CUDRS0007E\",\r\n\"properties\": [],\r\n}\r\n}\r\n```\r\n\r\nThe client could do a better job of surfacing the real reason for the failure instead of a generic explanation of the HTTP code."}}
{"actor":{"display_login":"amitmangalvedkar"}}