API v2.0 problem adding users

thedude

New Member
Nov 17, 2017
2
0
1
56
I'm trying to add users to a Proxmox cluster using Proxmoxer and Python 2.7, but the API is giving me an error. I've Googled and played around, but can't figure it out. Help?

Here's the HTTP transaction.

POST /api2/json/access/users HTTP/1.1\r
Host: 172.25.20.44:8006\r
Connection: keep-alive\r
Accept-Encoding: gzip, deflate\r
accept: application/json, application/x-javascript, text/javascript, text/x-javascript, text/x-json\r
User-Agent: python-requests/2.18.4\r
Content-Length: 117\r
Content-Type: application/x-www-form-urlencoded\r
CSRFPreventionToken: 5A0F66EB:1p3MAhYtu/lfAeM1ojDGIcsqRAs\r
\r
enable=1&password=general+stairs+closely+show+welcome&userid=testuser&email=testuser%40riseup.net%0A&groups=testgrp

HTTP/1.1 400 Parameter verification failed.\r
Cache-Control: max-age=0\r
Connection: close\r
Date: Fri, 17 Nov 2017 22:47:07 GMT\r
Pragma: no-cache\r
Server: pve-api-daemon/3.0\r
Content-Length: 109\r
Content-Type: application/json;charset=UTF-8\r
Expires: Fri, 17 Nov 2017 22:47:07 GMT\r
\r
{"errors":{"userid":"invalid format - value 'testuser' does not look like a valid user name\\n"},"data":null}
 
aaand I just figured it out. I needed to add '@pve' to the end of the userid. *bangs head on desk*