Here's the shell line I'm using to try to use the API to create a user account:
But I get the response:
But the group 1006 exists... that's what almost all our users are in. If I use the API to retrieve user infomation, it returns the group exactly the way I'm submitting it:
I tried some other groups, including wheel (0), but I got the same response.
Also, incidentally, the parameter "bsdusr_uid" is required? Whether you go through the FreeNAS web GUI, or use adduser in the shell on a regular *NIX, that's optional... if you leave it blank in adduser, it autofills the next available number, and in the FreeNAS API, the form for adding a user comes up with the next available number automatically filled in. It looks like every time I want to use the API to add a user, I first need to use the API to retrieve a list of all users and then parse the list to find out the last user number and add 1? Isn't not knowing which ID's are available going to be the standard usage case when creating a user through the API? How often do admins actually want to designate specific numbers for new users?
/rant
Anyway, I can handle finding the user ID programmatically, I just need help with specifying a valid group ID.
Thanks,
Tom.
Code:
curl -X POST -u root:[password was here] -H 'Content-Type: application/json' -d '{ "bsdusr_password": "TestPassword", "bsdusr_creategroup": false, "bsdusr_username": "testUser", "bsdusr_full_name": "Testy McUserface", "bsdusr_uid": 1033, "bsdusr_group": 1006}' http://192.168.10.222/api/v1.0/account/users/
But I get the response:
Code:
{"bsdusr_group": ["Select a valid choice. That choice is not one of the available choices."]}
But the group 1006 exists... that's what almost all our users are in. If I use the API to retrieve user infomation, it returns the group exactly the way I'm submitting it:
Code:
, "bsdusr_group": 1006,
I tried some other groups, including wheel (0), but I got the same response.
Also, incidentally, the parameter "bsdusr_uid" is required? Whether you go through the FreeNAS web GUI, or use adduser in the shell on a regular *NIX, that's optional... if you leave it blank in adduser, it autofills the next available number, and in the FreeNAS API, the form for adding a user comes up with the next available number automatically filled in. It looks like every time I want to use the API to add a user, I first need to use the API to retrieve a list of all users and then parse the list to find out the last user number and add 1? Isn't not knowing which ID's are available going to be the standard usage case when creating a user through the API? How often do admins actually want to designate specific numbers for new users?
/rant
Anyway, I can handle finding the user ID programmatically, I just need help with specifying a valid group ID.
Thanks,
Tom.