Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT user object not validating - it's creating a new user. #5

Open
bheavner opened this issue Apr 27, 2018 · 1 comment
Open

PUT user object not validating - it's creating a new user. #5

bheavner opened this issue Apr 27, 2018 · 1 comment

Comments

@bheavner
Copy link

From this, I expect a PUT on a user object should validate a user (and a POST should register a new user - https://github.com/fair-research/minid-server/blob/master/rest-api.rst . However, when I do a PUT with an existing user, I get a 201 CREATED response and an email is sent with a new registration code:

-> PUT /minid/user HTTP/1.1
-> Host: minid.bd2k.org
-> User-Agent: libcurl/7.54.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> Content-Type: application/json
-> Content-Length: 127
-> 
>> {"email":"[email protected]","name":"Ben Heavner","orcid":"0000-0003-2898-9044","code":"<my secret code>"}

<- HTTP/1.1 201 CREATED
<- Date: Thu, 26 Apr 2018 23:52:54 GMT
<- Server: Apache/2.4.7 (Ubuntu)
<- Content-Length: 96
<- Content-Type: application/json

Further, the content returned does not have a code - only the email does:

Response [http://minid.bd2k.org/minid/user]
  Date: 2018-04-27 16:25
  Status: 201
  Content-Type: application/json
  Size: 96 B
{
  "email": "[email protected]", 
  "name": "Ben Heavner", 
  "orcid": "0000-0003-2898-9044"
}
@bheavner
Copy link
Author

A POST has the same behavior, and will create a new code for an existing user:

> httr::POST("http://minid.bd2k.org/minid/user",
+           body = list(email = email(config),
+                        name = user(config),
+                        orcid = orcid(config)),
+           encode = "json",
+           httr::verbose())
-> POST /minid/user HTTP/1.1
-> Host: minid.bd2k.org
-> User-Agent: libcurl/7.54.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> Content-Type: application/json
-> Content-Length: 81
-> 
>> {"email":"[email protected]","name":"Ben Heavner","orcid":"0000-0003-2898-9044"}

<- HTTP/1.1 201 CREATED
<- Date: Fri, 27 Apr 2018 16:33:22 GMT
<- Server: Apache/2.4.7 (Ubuntu)
<- Content-Length: 96
<- Content-Type: application/json
<- 
Response [http://minid.bd2k.org/minid/user]
  Date: 2018-04-27 16:33
  Status: 201
  Content-Type: application/json
  Size: 96 B
{
  "email": "[email protected]", 
  "name": "Ben Heavner", 
  "orcid": "0000-0003-2898-9044"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant