I want to automate processes in NSX-T, using vRO actions.
The issue a REST request against the NSX-T REST API, you are required to add a header containing a XSRF token.
This works fine when using curl or the vs code rest client:
GET https://ip_of_manager/api/v1/logical-ports
X-XSRF-TOKEN: 8f82b10a-a72b-4a3a-a2bc-5512edf4ad0a
I add the XSRF token (and other parameters) when constructing the REST request in vRO similar to this:
request.setHeader("X-XSRF-TOKEN: 8f82b10a-a72b-4a3a-a2bc-5512edf4ad0a");
Executing the request fails with error 400 and a message appears:
response = request.execute();
error_message: A Valid Xsrf Token header must be provided with the Http Request.
How can I add the XSRF token to the rest request for this operation to work?
This may or may not be of use to you, but worth a shot?
https://www.pramodrane.com/vrealize-automation-rest-api-deploy-3-tier-app-with-nsx-networks/
The post did not contain information that would help in this case, however I've cross-posted the question to the vRA forum and received a solution: Link
Kudos to @eoinbyrne
