{"action":"created","issue":{"url":"https://api.github.com/repos/IQSS/dataverse/issues/2418","labels_url":"https://api.github.com/repos/IQSS/dataverse/issues/2418/labels{/name}","comments_url":"https://api.github.com/repos/IQSS/dataverse/issues/2418/comments","events_url":"https://api.github.com/repos/IQSS/dataverse/issues/2418/events","html_url":"https://github.com/IQSS/dataverse/issues/2418","id":97716331,"number":2418,"title":"mismatch between user id in JSON response of created user and user id when looking it up in the database","user":{"login":"pdurbin","id":21006,"avatar_url":"https://avatars.githubusercontent.com/u/21006?v=3","gravatar_id":"","url":"https://api.github.com/users/pdurbin","html_url":"https://github.com/pdurbin","followers_url":"https://api.github.com/users/pdurbin/followers","following_url":"https://api.github.com/users/pdurbin/following{/other_user}","gists_url":"https://api.github.com/users/pdurbin/gists{/gist_id}","starred_url":"https://api.github.com/users/pdurbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdurbin/subscriptions","organizations_url":"https://api.github.com/users/pdurbin/orgs","repos_url":"https://api.github.com/users/pdurbin/repos","events_url":"https://api.github.com/users/pdurbin/events{/privacy}","received_events_url":"https://api.github.com/users/pdurbin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IQSS/dataverse/labels/Component:%20API","name":"Component: API","color":"c7def8"},{"url":"https://api.github.com/repos/IQSS/dataverse/labels/Type:%20Bug","name":"Type: Bug","color":"fef2c0"}],"state":"open","locked":false,"assignee":{"login":"scolapasta","id":4268292,"avatar_url":"https://avatars.githubusercontent.com/u/4268292?v=3","gravatar_id":"","url":"https://api.github.com/users/scolapasta","html_url":"https://github.com/scolapasta","followers_url":"https://api.github.com/users/scolapasta/followers","following_url":"https://api.github.com/users/scolapasta/following{/other_user}","gists_url":"https://api.github.com/users/scolapasta/gists{/gist_id}","starred_url":"https://api.github.com/users/scolapasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scolapasta/subscriptions","organizations_url":"https://api.github.com/users/scolapasta/orgs","repos_url":"https://api.github.com/users/scolapasta/repos","events_url":"https://api.github.com/users/scolapasta/events{/privacy}","received_events_url":"https://api.github.com/users/scolapasta/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/IQSS/dataverse/milestones/39","html_url":"https://github.com/IQSS/dataverse/milestones/4.2","labels_url":"https://api.github.com/repos/IQSS/dataverse/milestones/39/labels","id":1143630,"number":39,"title":"4.2","description":"- Performance of dataset pages with many files\r\n- Permissions performance #2036\r\n- Restructure Files listing page\r\n- FITS files explored in WWT","creator":{"login":"eaquigley","id":5922904,"avatar_url":"https://avatars.githubusercontent.com/u/5922904?v=3","gravatar_id":"","url":"https://api.github.com/users/eaquigley","html_url":"https://github.com/eaquigley","followers_url":"https://api.github.com/users/eaquigley/followers","following_url":"https://api.github.com/users/eaquigley/following{/other_user}","gists_url":"https://api.github.com/users/eaquigley/gists{/gist_id}","starred_url":"https://api.github.com/users/eaquigley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eaquigley/subscriptions","organizations_url":"https://api.github.com/users/eaquigley/orgs","repos_url":"https://api.github.com/users/eaquigley/repos","events_url":"https://api.github.com/users/eaquigley/events{/privacy}","received_events_url":"https://api.github.com/users/eaquigley/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":0,"state":"open","created_at":"2015-06-01T19:53:20Z","updated_at":"2015-07-29T13:30:59Z","due_on":"2015-08-25T04:00:00Z","closed_at":null},"comments":2,"created_at":"2015-07-28T14:10:27Z","updated_at":"2015-07-29T14:32:00Z","closed_at":null,"body":"I haven't committed this test yet, but I'm seeing a mismatch between the user id in JSON response of created user and user id when looking it up in the database:\r\n\r\n```\r\nRunning edu.harvard.iq.dataverse.api.BuiltinUsersIT\r\n{\r\n    \"status\": \"OK\",\r\n    \"data\": {\r\n        \"user\": {\r\n            \"id\": 11357,\r\n            \"firstName\": \"firstName\",\r\n            \"lastName\": \"lastName\",\r\n            \"userName\": \"37f9be2b\",\r\n            \"email\": \"37f9be2b@mailinator.com\"\r\n        },\r\n        \"apiToken\": \"b92c8fc5-f513-4853-afcd-8e6570cf91ed\"\r\n    }\r\n}\r\n11357 was the id from JSON response on create\r\n{\r\n    \"status\": \"OK\",\r\n    \"data\": {\r\n        \"identifier\": \"@37f9be2b\",\r\n        \"id\": 11356\r\n    }\r\n}\r\n11356 was the id from the database\r\n```\r\n\r\nThe bug seems to be in the JSON response because the new method I wrote to look up the id in the database returns the right id:\r\n\r\n```\r\ndataverse_db=# select id,useridentifier from authenticateduser where useridentifier = '37f9be2b';\r\n  id   | useridentifier \r\n-------+----------------\r\n 11356 | 37f9be2b\r\n(1 row)\r\n```\r\n\r\nSo the question is why the JSON coming back from creating the user via API is off.\r\n\r\nI'm on commit e2d4fa3 as of this writing."},"comment":{"url":"https://api.github.com/repos/IQSS/dataverse/issues/comments/125970511","html_url":"https://github.com/IQSS/dataverse/issues/2418#issuecomment-125970511","issue_url":"https://api.github.com/repos/IQSS/dataverse/issues/2418","id":125970511,"user":{"login":"pdurbin","id":21006,"avatar_url":"https://avatars.githubusercontent.com/u/21006?v=3","gravatar_id":"","url":"https://api.github.com/users/pdurbin","html_url":"https://github.com/pdurbin","followers_url":"https://api.github.com/users/pdurbin/followers","following_url":"https://api.github.com/users/pdurbin/following{/other_user}","gists_url":"https://api.github.com/users/pdurbin/gists{/gist_id}","starred_url":"https://api.github.com/users/pdurbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdurbin/subscriptions","organizations_url":"https://api.github.com/users/pdurbin/orgs","repos_url":"https://api.github.com/users/pdurbin/repos","events_url":"https://api.github.com/users/pdurbin/events{/privacy}","received_events_url":"https://api.github.com/users/pdurbin/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T14:32:00Z","updated_at":"2015-07-29T14:32:00Z","body":"Actually the new method added to `api/Admin.java` in e45dd79 is allowing me to move forward in my integration test writing. Basically, I don't trust the id value given back in the JSON when I create a user. I always double check with my new API endpoint what the actual database id is.\r\n\r\nOh, I wonder if @michbarsinai has any thoughts on this."}}