NOTE:  Make sure correct site/appliance names passed in the delete request

Steps to make an API to Analytics (Replace the highlighted values accordingly)

Login:

Step 1: Get the X-CSRF-Token 

curl -c cookies.txt -k -v -X GET 'https://<Analytics-IP>/versa/analytics/id'

#Sample

Step 2: Start authentication with the same session, and use the CSRF token extracted from the Step 1's response Headers (x-csrf-token). Read the cookie with the same session and update the cookie with the new authenticated session and update the CSRF token.

curl -b cookies.txt -c cookies.txt -kv -d "username=admin&password=versa123" -H "X-CSRF-Token:1d6e568e-4854-4f71-b5a4-964409a96c80"  https://<Analytics-IP>
/versa/login

#Sample

Make API to appropriate endpoint to delete SDWAN site or appliance:

Please note each delete request (any request other than GET) will require a new CSRF Token (which can extracted from each response)

To Delete Site
curl -b cookies.txt -k -v -H "X-CSRF-Token:f8abe09d-dbe5-44a5-9b42-3242fa300ae0" -X DELETE  'https://
<Analytics-IP>/versa/analytics/v0.0.1/clean/system/info/tenants/<tenant-name>/site/<site-name>'

#Sample


To Delete Appliance
curl -b cookies.txt -k -v -H "X-CSRF-Token:12fdc6bc-c44d-4585-9ee8-deb0887fb283" -X DELETE  'https://<Analytics-IP>/versa/analytics/v0.0.1/clean/system/info/tenants/<tenant-name>/site/<site-name>/appliance/<appliance-name>'

#Sample

Logout:

curl -b cookies.txt -k -v  -X POST -H "X-CSRF-Token:f8abe09d-dbe5-44a5-9b42-3242fa300ae0"  'https://<Analytics-IP>/versa/logout'

#Sample