{"action":"created","issue":{"url":"https://api.github.com/repos/auth0/auth0-java/issues/58","repository_url":"https://api.github.com/repos/auth0/auth0-java","labels_url":"https://api.github.com/repos/auth0/auth0-java/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/auth0/auth0-java/issues/58/comments","events_url":"https://api.github.com/repos/auth0/auth0-java/issues/58/events","html_url":"https://github.com/auth0/auth0-java/issues/58","id":234648324,"number":58,"title":"Add ability to set only certain properties when updating a user.","user":{"login":"brettcooper","id":16801405,"avatar_url":"https://avatars2.githubusercontent.com/u/16801405?v=3","gravatar_id":"","url":"https://api.github.com/users/brettcooper","html_url":"https://github.com/brettcooper","followers_url":"https://api.github.com/users/brettcooper/followers","following_url":"https://api.github.com/users/brettcooper/following{/other_user}","gists_url":"https://api.github.com/users/brettcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/brettcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettcooper/subscriptions","organizations_url":"https://api.github.com/users/brettcooper/orgs","repos_url":"https://api.github.com/users/brettcooper/repos","events_url":"https://api.github.com/users/brettcooper/events{/privacy}","received_events_url":"https://api.github.com/users/brettcooper/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-08T20:34:52Z","updated_at":"2017-06-08T21:02:21Z","closed_at":"2017-06-08T21:02:21Z","body":"When calling the management API to update a user, I am always receiving the following exception:\r\n\r\ncom.auth0.exception.APIException: Request failed with status code 400: Payload validation error: 'Additional properties not allowed: logins_count,last_login,identities,updated_at,created_at,nickname,name,picture,user_id (consider storing them in app_metadata or user_metadata. See \"Users Metadata\" in https://auth0.com/docs/api/v2/changes for more details)'.\r\n\r\nAccording to the Auth0 API [documentation](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id), it looks like we should only be sending properties for the user that have changed (e.g. - email, email_verified, user_metadata, etc.)  But, with the current API's implementation, this is not possible and I have had to write my own REST call to make this work (I am just trying to update a user so that user is blocked).\r\n\r\nSomething similar to this should work:\r\n\r\n    public Request<User> update(String userId, String json) {\r\n        Asserts.assertNotNull(userId, \"user id\");\r\n        Asserts.assertNotNull(json, \"json\");\r\n        String url = this.baseUrl.newBuilder().addPathSegments(\"api/v2/users\").addPathSegment(userId).build().toString();\r\n        CustomRequest<User> request = new CustomRequest(this.client, url, \"PATCH\", new TypeReference<String>() {\r\n        });\r\n        request.addHeader(\"Authorization\", \"Bearer \" + this.apiToken);\r\n        request.setBody(json);\r\n        return request;\r\n    }\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/auth0/auth0-java/issues/comments/307226536","html_url":"https://github.com/auth0/auth0-java/issues/58#issuecomment-307226536","issue_url":"https://api.github.com/repos/auth0/auth0-java/issues/58","id":307226536,"user":{"login":"lbalmaceda","id":3900123,"avatar_url":"https://avatars0.githubusercontent.com/u/3900123?v=3","gravatar_id":"","url":"https://api.github.com/users/lbalmaceda","html_url":"https://github.com/lbalmaceda","followers_url":"https://api.github.com/users/lbalmaceda/followers","following_url":"https://api.github.com/users/lbalmaceda/following{/other_user}","gists_url":"https://api.github.com/users/lbalmaceda/gists{/gist_id}","starred_url":"https://api.github.com/users/lbalmaceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbalmaceda/subscriptions","organizations_url":"https://api.github.com/users/lbalmaceda/orgs","repos_url":"https://api.github.com/users/lbalmaceda/repos","events_url":"https://api.github.com/users/lbalmaceda/events{/privacy}","received_events_url":"https://api.github.com/users/lbalmaceda/received_events","type":"User","site_admin":false},"created_at":"2017-06-08T21:02:21Z","updated_at":"2017-06-08T21:02:21Z","body":"User should have a public constructor with no args but it seems it's missing. Anyway, if you see the code the same can be achieved by passing a null connection.\r\n\r\n```java\r\n        ManagementAPI managementAPI = new ManagementAPI(\"the_domain\",\"the_api_token\");\r\n        User user = new User(null);\r\n        user.setBlocked(true);\r\n        managementAPI.users().update(\"your_user_id\", user).execute();\r\n```"}}
{"actor":{"display_login":"lbalmaceda"}}