HTTP Bridge — VMware Salt API
HTTP Bridge
The HTTP (or HTTPS) bridge accepts JSON payloads POSTed to an endpoint exposed by SSE, translates the payloads into RPC calls, then returns the result as JSON. The endpoint supports cookie-based authentication so that authentication credentials need to be passed only once per session. The bridge also allows sending multiple calls in a single payload.
If xsrf is enabled (default with state install) in
/etc/raas/raas.conf via tornado_xsrf_cookies_enabled: True,
you must provide an X-Xsrftoken header on each REST call. The best way is
to save a cookie with an initial GET call, then use the cookie to provide the header
token. This cookie is saved in the $HOME (user's home) directory.
The payload is a dictionary.
Example cURL call with xsrf header
curl -k -c $HOME/eAPICookie.txt -u root:PASSWORD 'https://localhost/account/login' >/dev/null
curl -k -u root:PASSWORD -b $HOME/eAPICookie.txt \
-H 'X-Xsrftoken: '$(grep -w '_xsrf' $HOME/eAPICookie.txt | cut -f7)'' \
-X POST https://localhost/rpc \
-d '{
"resource": "sec",
"method": "download_content",
"kwarg": {"auto_ingest": true}
}'