cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
661
Views
2
Helpful
2
Replies

CES API Request Format Help

ross-crawford
Level 1
Level 1

I'm looking for help as to how to format the Post request to test our API connectivity to one of our CES Gateway servers. Cisco support have ensured that this is enabled, although we are not able to view the interfaceconfig ourselves. I am following the format from the below documentation:

AsyncOS 14.0 API for Cisco Secure Email Gateway - Getting Started Guide - GD (General Deployment) - Overview of AsyncOS API for Cisco Secure Email Gateway [Cisco Secure Email Gateway] - Cisco

If you could take a look at our config below and see if there's any mistakes I'm making. We've double checked the firewall and the traffic is not being blocked there, however if I run a Test-Netconnection from PowerShell to our gateway server for port 6080 the TCP test fails, so I'm unsure if the port is even open (although Cisco assures us it is).

My request looks as follows:

POST http://<appliance_FQDN>:6080/esa/api/v2.0/login/

Headers:

Postman-Token                  <calculated when request is sent>  

Content-Length                   <calculated when request is sent> 

Host:                                   <calculated when request is sent> 

User-Agent:                       curl/7.54.0

Accept:                              */*

Accept-Encoding:               gzip, deflate, br    

Connection:                       keep-alive

Content-Type:                    application/json

Cache-Control                    no-cache

 

Body:

{
    "data":
    {
        "userName":"<username_in_base64>",
        "passphrase":"<password_in_base64>"
    }
}
 
Authorisation:
 
I'm a bit confused as to what this should be set to in Postman? Should this be the same credentials as in the body?
 
Thanks in advance for any help.
 
2 Replies 2

msaalim
Cisco Employee
Cisco Employee

Hello,

Begin by executing a POST request to the URL http://<dhxxxx>:6080/esa/api/v2.0/login. Ensure that the Authorization header is set to no authentication ('No Auth'). In the request body, provide your base64-encoded username and password in the following format:
{
     "data":
     {
            "userName":"username_in_base64",
            "passphrase":"password_in_base64"
     }
}

Once you've successfully received the jwtToken, switch the Authorization method to 'API key'. Input the jwtToken you obtained as the API key's value for subsequent API requests. Refer to the API documentation for further details on how to structure these requests.
I trust this explanation will be helpful to you or you can reach out to Cisco Technical Support for assistance

 

saliyev
Cisco Employee
Cisco Employee

the more easiest way to check API on CES is to check New-GUI (NGUI). it works by API. if you can able to login NGUI and navigate some pages (reportings, MT, etc.) API is fine.
and btw, here you can catch some API requests by using browser's web traffic trace (F12).