tbaror
Contributor
- Joined
- Mar 20, 2013
- Messages
- 105
Hi All,
I started to play with Freenas Api , the task i trying to accomplish is create bulk of users
While creating one user all seems to work fine using following below example
But when i am trying to make python read json file with bulk of users i get error
My question is what would be best way to write bulk of users to freenas
Thanks
create single user
I started to play with Freenas Api , the task i trying to accomplish is create bulk of users
While creating one user all seems to work fine using following below example
But when i am trying to make python read json file with bulk of users i get error
Code:
{"error_message": "Sorry, this request could not be processed. Please try again later."}My question is what would be best way to write bulk of users to freenas
Thanks
create single user
Code:
import json
import requests
r = requests.post(
'http://192.10.11.245/api/v1.0/account/users/',
auth=('root', 'password'),
headers={'Content-Type': 'application/json'},
verify=False,
data=json.dumps({
"bsdusr_builtin": 'false',
"bsdusr_email": "",
"bsdusr_full_name": "testuser",
"bsdusr_password": "password",
"bsdusr_group": 14,
"bsdusr_home": "/mnt/PO01/ftp_vol/FtpRoot/Customers/testuser/",
"bsdusr_locked": 'false',
"bsdusr_password_disabled": 'false',
"bsdusr_uid": 1201,
"bsdusr_username": "testuser",
"bsdusr_sudo":'false',
} )
)
print(r.text)