Forum Discussion
Francois_LAGANT
Nimbostratus
Aug 24, 2022API REST error 400
Hello, I try to download an ssl certificate via the REST APIs /mgmt/tm/sys/crypto/cert from f5 but I always get the following response: curl -sk -H "X-F5-Auth-Token: XXXXXX" https://x.x.x.x/mgm...
Francois_LAGANT
Nimbostratus
Aug 25, 2022I saw on a devcentral post that it was necessary to add file: to the pathfile.
curl -sku admin:admin -X POST https://x.x.x.x/mgmt/tm/sys/file/ssl-cert -H 'Content-Type: application/json' -d '{"name":"testcsr.crt","partition": "Common","sourcePath":"file:/var/www/html/certs/certificats/files/test_certificate.pem"}'{
"code": 400,
"message": "Failed! exit_code (37).\n",
"errorStack": [],
"apiError": 26214401
}from f5.bigip import ManagementRoot
# Connect to the BIG-IP
mgmt = ManagementRoot("x.x.x.x", "admin", "admin")
cert = mgmt.tm.sys.file.ssl_certs.ssl_cert.create(name='test_cert', sourcePath='file:/var/www/html/certs/certificats/files/test_certificate.pem')Traceback (most recent call last):
File "/root/test-f5-api.py", line 22, in <module>
cert = mgmt.tm.sys.file.ssl_certs.ssl_cert.create(name='test_cert', sourcePath='file:/var/www/html/certs/certificats/files/test_certificate.pem')
File "/root/f5-common-python/f5/bigip/resource.py", line 1053, in create
return self._create(**kwargs)
File "/root/f5-common-python/f5/bigip/resource.py", line 1015, in _create
response = session.post(_create_uri, json=kwargs, **requests_params)
File "/usr/local/lib/python3.9/site-packages/icontrol/session.py", line 295, in wrapper
raise iControlUnexpectedHTTPError(error_message, response=response)
icontrol.exceptions.iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri: https://lbaind2itvpx101-adm.nor.fr.intraorange:443/mgmt/tm/sys/file/ssl-cert/
Text: '{"code":400,"message":"Failed! exit_code (37).\\n","errorStack":[],"apiError":26214401}'
it would be a problem of rights or other API but I don't know where?
JRahm
Admin
Aug 25, 2022Looks like you're missing a letter in certificates in your source file path on quick glance.
on my phone with a break in daddy duty...can dig in a little later this morning once little man gets to preschool.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects