Forum Discussion

D_Lamb's avatar
D_Lamb
Comet
26 days ago

How to Delete VPN Users via GraphQL API

Greetings,

I'm working on automating user cleanup and am attempting to delete inactive VPN users via the Cato API. According to the API conventions, I assumed the following mutation would work to remove users from our account: Sorry for the poor formatting.

 

mutation deleteEntities($accountID: ID!, $entityIDs: [ID!]!)

{  deleteEntities(accountID: $accountID, entityIDs: $entityIDs) {   

    success    

    failed {

     userID      

         reason    }  

} } 

 

I'm calling it in Python with:

delete_variables = {    "accountID": account_id,    "entityIDs": [uid] }

delete_response = requests.post(API_URL, headers=HEADERS, 

json={    "query": delete_mutation,    "variables": delete_variables })

 

However, I receive the following error in the response:

{  "errors": [    {      "message": "Cannot query field 'deleteEntities' on type 'Mutation'.",      "extensions": {        "code": "GRAPHQL_VALIDATION_FAILED"      }    }  ],  "data": null } 

What I am trying to figure out is:

  1. Is deleteEntities a valid mutation for deleting VPN users?
  2. If not, what is the correct GraphQL mutation for deleting users?

Thank you guys!

1 Reply

  • Hi D_Lamb, 

    Just to check, do you have a support ticket on this at the moment?

    Cheers