Content
You are here:
api3: create user error 500
Added by Thomas Waas about 5 years ago
Hi all,
I'm new to OpenProject, doing first steps with the api.
Would like to create users through api calls, but fail and can't find examples / solutions anywhere in the web...
Got an API key, authentication works, I can get a list of existing users by GET'ing /api/v3/users, nice json list, all good.
Now I'm trying to create a user.
I'm POST'ing to /api/v3/users, but get a result code 500 and a content saying
'_content' => '{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:InternalServerError","message":"An internal error has occured. 405 Not Allowed"}'
My request is:
DB<4> x $request
0 HTTP::Request=HASH(0x7fbba0c6b680)
'_content' => '{ "login": "h.wurst", "email": "h.wurst@openproject.com", "firstName": "Hans", "lastName": "Wurst", "admin": true, "language": "en"}'
'_headers' => HTTP::Headers=HASH(0x7fbba0c6b6f8)
'::std_case' => HASH(0x7fbba0c6bfe0)
'if-ssl-cert-subject' => 'If-SSL-Cert-Subject'
'authorization' => 'Basic xxxxx'
'content-length' => 132
'content-type' => 'application/json'
'user-agent' => 'libwww-perl/6.05'
'_method' => 'PUT'
'_uri' => URI::https=SCALAR(0x7fbb9ffc1f30)
-> 'https://openproject.wawawis.com:447/api/v3/users'
'_uri_canonical' => URI::https=SCALAR(0x7fbb9ffc1f30)
-> REUSED_ADDRESS
, a copy & paste from the API documentation (after stripping \n\c characters).
No matter what I try, same result. I'm stuck.
If somebody please could enlighten me, I'm running out of ideas....
Thanks,
Thomas.
Replies (1)
Stupid me.
PUT != POST
That's all what was wrong.
Just use the right request. Oh my.
Sorry for the noise,
Thomas.