VMware Solutions Discussions
VMware Solutions Discussions
I'm trying to upgrade the self signed certificate of ONTAP Tools for vSphere version 10.4 to one signed by our internal MS CA.
When doing so, I receive the error The payload for POST request is invalid.
I already found KB: Unable to upgrade from certificate to CA in ONTAP Tools for VMware vSphere v10.3 - NetApp Knowledge Base
This however does not help.
Solved! See The Solution
Hi, @FilipS
I just got back into town after a bit of travel. Eyeballing your API calls, and comparing to my lab, it looks like you need to add the -H "x-auth: [JWT token]" with your JWT token from the output of your authentication. Like this:
curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H "accept: application/json" -H "x-auth: JWT_Token" -H "Content-Type: application/json" -d "{\"cert\":\"string\"}"
Here is a screenshot.
Interesting. I wonder if there is some kind of bug with the way the GUI takes the certificate contents and malforms the REST API.
Can you try using the REST API instead of the GUI?
https://<OTV.IP>:8443/#/Commons/virtualization__commonsAddCertificate
If you do use the REST APIs, you will need to authenticate and get a token here:
https://<IP>:8443/#/Auth/virtualization__validateAdminLogin
Hmmm. I'm getting the following response:
{ "error": { "code": "error_converting_input_to_certificate_request", "message": "Error converting input to Certificate request", "target": "Certificates" } }
I see, can you post the curl -X POST command generated by swagger? Alter the username/password/certificate for security.
Here you go.
Authentication:
curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/auth/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"username\":\"Administrator\",\"password\":\"mypassword\"}"
Add certificate:
curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"cert\": \"mycert...\"}"
Hi, @FilipS
I just got back into town after a bit of travel. Eyeballing your API calls, and comparing to my lab, it looks like you need to add the -H "x-auth: [JWT token]" with your JWT token from the output of your authentication. Like this:
curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H "accept: application/json" -H "x-auth: JWT_Token" -H "Content-Type: application/json" -d "{\"cert\":\"string\"}"