Skip to main content
McAfee MVISION Cloud

API to Export CSPM Policies

This API fetches the CSPM Configuration Audit policies authored using the policy builder in a readable format.

Step 1: API to Get an Access Token

API: POST  https://www.myshn.net/neo/neo-auth-service/oauth/token?grant_type=password

Request Headers: x-auth-username: <<Email id of MVISION Cloud Application>> 
                                  x-auth-password: <<Password of MVISION Cloud Application>> 

Response : 

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3ByaW5nLWJvb3QtYXBwbGljYXRpb24iXSwidGVuYW50TmFtZSI6ImF3c3Rlc3QiLCJ1c2VyX25hbWUiOiJrcmlzaG5hX2MrYXdzdGVzdEBtY2FmZWUuY29tIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIl0sInRlbmFudElEIjo1NTUxMSwiZXhwIjoxNTY0NDY2ODYxLCJ1c2VyIjoia3Jpc2huYV9jK2F3c3Rlc3RAbWNhZmVlLmNvbSIsInVzZXJJZCI6MTQxODM5LCJqdGkiOiJlZWNiOTUzMC0yYWU1LTRmYTUtYTEyOC0xZjQzNjk0MGM1YzQiLCJlbWFpbCI6ImtyaXNobmFfYythd3N0ZXN0QG1jYWZlZS5jb20iLCJjbGllbnRfaWQiOiJ0cnVzdGVkLWFwcCJ9.S1jINLsbFTUem7-hPltjW9_bS5zAIQyOL-clZqqRizi0GEYCwTiSnkqAAO5Sa-53mOmus0vX_hn5b3eKiceNOQhd7qtXAROXRd7THqwOIK3Y6apmCf2ZBKvRvwp-yVY8OyJJ2Nk2H396mEEFc56Kdy8jK6krPlLHCqOdi49d3-SFagFmW_gP3UMql1-nkrza48YoeN3z91ZMTtS650mdNfARlbLL14A_JV0OVKH3AmdC6PeODkHnXq5xcBiou02rC8GWciEdqqDiJ_V8VAU_sk8r9C4O-9aPvbumbQU5VjKGxV1XJheENEYOW5dXZ52ffBn0tsrim6E_IgWkUWn0cQ",
    "token_type": "bearer",
    "refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3ByaW5nLWJvb3QtYXBwbGljYXRpb24iXSwidGVuYW50TmFtZSI6ImF3c3Rlc3QiLCJ1c2VyX25hbWUiOiJrcmlzaG5hX2MrYXdzdGVzdEBtY2FmZWUuY29tIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIl0sImF0aSI6ImVlY2I5NTMwLTJhZTUtNGZhNS1hMTI4LTFmNDM2OTQwYzVjNCIsInRlbmFudElEIjo1NTUxMSwiZXhwIjoxNTY0NTUyMzYxLCJ1c2VyIjoia3Jpc2huYV9jK2F3c3Rlc3RAbWNhZmVlLmNvbSIsInVzZXJJZCI6MTQxODM5LCJqdGkiOiI2MWE4ZmFiNC0xODQwLTQ0ODctYjgyZC05NzU2MGJmM2I5NzYiLCJlbWFpbCI6ImtyaXNobmFfYythd3N0ZXN0QG1jYWZlZS5jb20iLCJjbGllbnRfaWQiOiJ0cnVzdGVkLWFwcCJ9.KViyhdxyPDc0ulkivqXNDzNHEzxlg02WFw-ddZSUduykiAHbNdfUWLcfzXINTVPqLtBU_9oWLtKh3HxAB_YXKwdc1A0Ko-RrGSopF710a9y4F51Sd8iEudy-sRzvhAey-huleOJaDKN1b3DeGwgtM10UG4bcri8Q3hF0NOL2Riv_HHtikq1eipPW_v5HUR81MO1rOi-uHu8R5ThlfT3Q1PF3JguePpFIdDWZ0b3EwLMEytpTtb64_68CtWEKYYDQyjtgiZj8vGfZJcN5AbzqRrcrRzBTH77NBoOCge5WpAaeHRFvff8jhb44jnEPbgetOFnXyCQPw1DOkkNirxVO5Q",
    "expires_in": 509,
    "scope": "read write",
    "tenantName": "My test",
    "tenantID": 12345,
    "user": "abc@xyz.com",
    "userId": 141839,
    "email": "abc@xyz.com",
    "jti": "eecb9530-2ae5-4fa5-a128-1f436940c5c4"
}


Step 2: API to Export a Policy in a Readable Format

API: POST https://www.myshn.net/neo/config-audit/policy-template/v1/readable-csv

Request Headers: x-access-token: <<Access token from the 1st API>>
                                  Content-Type: application/json
Request Body:      

{
"policy_ids":[],
"csp_id":2049,
"all_policies":false
}

Construction of the Request body:

The request body contains:

  1. policy_ids. Single or list of policy IDs(comma separated) that you wish to export
  2. csp_id. ID of the cloud service provider. For AWS: 2049, Azure: 4366, GCP: 13465.
  3. all_policies. To export all policies, provide the value as 'true'. You do not need to provide the policy IDs.

Response:  

The response includes a CSV file with readable policy rules that you can save.

Errors

  1. Error message in case of invalid CSP ID. Unsupported CSP id. Please provide correct IAAS CSP id.
  2. Error message in case of invalid Policy IDs. No policies found for policyIds: [<Policy_Id>]
  • Was this article helpful?