Chris Ekcennel
Cadet
- Joined
- Nov 14, 2015
- Messages
- 7
Hi,
My Python script to import the certificate using API 1.0 stopped working after I upgraded FreeNAS 11 to TrueNAS 12.
My Python code used to look like the following and the status code was 201 if it was imported successfully.
It does not work anymore on TrueNAS 12.
So after reading the 2.0 REST API documentation a little bit, I tried the following:
And this doesn't work either. I got the status_code of 200.
Any suggestions?
Thanks,
My Python script to import the certificate using API 1.0 stopped working after I upgraded FreeNAS 11 to TrueNAS 12.
My Python code used to look like the following and the status code was 201 if it was imported successfully.
Code:
r = requests.post( 'http://' + HOST + '/api/v1.0/system/certificate/import/', auth=(USER, PASSWORD), headers={'Content-Type': 'application/json'}, data=json.dumps({ "cert_name": cert_name, "cert_certificate": cert, "cert_privatekey": priv_key, "cert_serial": 1 }), )
It does not work anymore on TrueNAS 12.
So after reading the 2.0 REST API documentation a little bit, I tried the following:
Code:
r = requests.post( 'http://' + HOST + '/api/v2.0/certificate', auth=(USER, PASSWORD), headers={'Content-Type': 'application/json'}, data=json.dumps({ "create_type": "CERTIFICATE_CREATE_IMPORTED", "name": cert_name, "certificate": cert, "privatekey": priv_key, "serial": 1 }), )
And this doesn't work either. I got the status_code of 200.
Any suggestions?
Thanks,