[pve-devel] User Creation ExtJS Help

Dietmar Maurer dietmar at proxmox.com
Fri Jul 1 09:01:38 CEST 2011


> I have gotten a little further.  I have discovered the "console"
> within Chrome and firebug in Firefox to help find the errors.  The create user box
> that appears is a little more presentable,

Wow, you use the PVE.Window.Edit class created yesterday - so you can consider yourself an 'early adopter' ;-)
 
(I will try to keep the code stable, no need to worry)

>  but I still can't get it to take the inputs
> from the box and it keeps telling me that the method "PUT" is not valid.

Notes on API URLs:

The web server exposes the API at: https://your.server:8006/api2/{requested_format}/

For example, you can simply browse the API using the web browser:

first, connect to https://your.server:8006/ and login, after that you can browse the api at:

https://your.server:8006/api2/html/

Inside the javascript code you usually want the server to return the data in JSON format, so 
the correct url is https://your.server:8006/api2/json/

ExtJS allows you to return more information about error, and automatically displays
that error information in forms (attached to the correct field). So if you work with ExtJS forms, you 
should use the following url:

https://your.server:8006/api2/extjs/

(return JSON with additional error information)

Note: PVE.Utils.API2Request automatically prepend '/api2/extjs' to the url

So the correct url parameters for the UserEdit.js are:

        if (create) {
            url = '/api2/extjs/access/users';
            method = 'POST';
        } else {
            url = '/api2/extjs/access/users/' + userid;
            method = 'PUT';
        }

I already committed that code.

- Dietmar





More information about the pve-devel mailing list