405 Method Not Allowed on `drone user add ...`

$ drone --version
drone version 1.0.3
$ drone user ls
myadmin
$ drone user info admin
User: myadmin
Email: [email protected]
Admin: true
Machine: false
$ drone user add testuser
client error 405:

Server log:

{"fields.time":"2018-11-27T23:13:31Z","latency":25024733,"level":"debug","method":"POST","msg":"","remote":"10.184.1.246:55626","request":"/api/users","request-id":"1Dai3WTk37qryjzPDKUbePal5KK","time":"2018-11-27T23:13:31Z"}

Manually with curl:

$ curl -0 -v -H "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXX" -H "Content-Type: application/json" --data '{"id":0,"login":"testuser","email":"","avatar_url":"","active":false,"admin":false,"machine":false,"syncing":false,"synced":0,"created":0,"updated":0,"last_login":0}' https://drone.domain.tld/api/users
*   Trying xx.xx.xx.xx...
...
*  SSL certificate verify ok.
> POST /api/users HTTP/1.0
> Host: drone.domain.tld
> User-Agent: curl/7.58.0
> Accept: */*
> Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXX
> Content-Type: application/json
> Content-Length: 165
> 
* upload completely sent off: 165 out of 165 bytes
< HTTP/1.1 405 Method Not Allowed
< Date: Tue, 27 Nov 2018 23:17:13 GMT
< Content-Length: 0
< Connection: close
< Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0
< Expires: Thu, 01 Jan 1970 00:00:00 UTC
< Pragma: no-cache
< Vary: Origin
< X-Accel-Expires: 0
< 
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):

Equivalent of drone user ls:

curl -0s -H "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXX" https://drone.domain.tld/api/users|jq
[
  {
    "id": 1,
    "login": "myadmin",
    "email": "[email protected]",
    "machine": false,
    "admin": true,
    "active": true,
    "avatar": "https://avatars3.githubusercontent.com/u/xxxxx?v=4",
    "syncing": false,
    "synced": 1543345882,
    "created": 1542689442,
    "updated": 1542689442,
    "last_login": 1543345881
  }
]

@bradrydzewski Seems like Swagger request validation?
Is routing now conducted by Swagger in 1.0?
Please, open the source code! :slight_smile:

no swagger, but the route was incorrectly mapped. I will push an rc.2 tomorrow which should have the fix included.

Nice! Thanks!
Don’t use casino’s ATMs :wink: