API v2.0 problem adding users

thedude

New Member
Nov 17, 2017
2
0
1
55
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*
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!