cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Cisco Secure Email Support Community

Product Support Talos Support Cisco Support Reference + Current Release
Gateway Reputation Lookup Open a support case Secure Email Guided Setup
Gateway: 14.2.0-616
Cloud Gateway Email Status Portal Support & Downloads docs.ces.cisco.com
Email and Web Manager: 14.2.0-203
Email and Web Manager Web & Email Reputation Worldwide Contacts Product Naming Quick Reference
Reporting Plug-in: 1.1.0.136
Encryption Bug Search
Encryption Plug-in: 1.2.1.167
Cloud Mailbox Notification Service
Outlook Add-in(s): More info

2709
Views
0
Helpful
3
Replies

questions about using AsyncOS API 12.0

Hello,

I have a cisco IronPort with q AsyncOS 12.0, and I have questions about how to use the API.

I looked at the documentation https://www.cisco.com/c/en/us/td/docs/security/security_management/sma/sma12-0/api/b_SMA_API_12/test_chapter_01.html, but I didn't understand how to connect and consume the data from API.

 

I ran the command curl -X GET --header 'Accept: application / json' -u {user =: pass} 'myip.com:6080/sma/api/v2.0/login' and got the following error:

 

{"error": {"message": "Unsupported method ('POST').", "code": "501", "explanation": "501 = Server does not support this operation."}} [root @ xxxxxx ironport] #

 

How can I do this communication using Python?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

 

Postman can still be useful as it will allow you to export the request in multiple ways (one being cURL) which can be used elsewhere. 

 

As an example, you could do something like this :

 

curl -sk -u admin:password https://<IPorFQDN>:<api-port>/sma/api/v2.0/config/system_time?device_type=sma
{"data": {"timezone": "America/New_York", "continent": ["America", "United States", "New_York"], "time": "Mon Aug 12 12:18:07 2019 EDT"}}

 

Thanks!

-Dennis M.

View solution in original post

3 REPLIES 3
Robert Sherwin
Cisco Employee

Hi Robert

Thanks for the help, but it's not exactly what I need. I can't use postman because only a Linux server has access to ironPort's Cisco Appliance.

 

Could you make these inquiries with curl or pytohn?

 

How do I use this example above?

 

Sample Request
POST /sma/api/v2.0/login
HTTP/1.1
Content-Type: application/json
cache-control: no-cache
User-Agent: curl/7.54.0
Accept: */*
Host: sma.cisco.com:6080
accept-encoding: gzip, deflate
content-length: 95
Connection: keep-alive
{
"data":
{
"userName":"YWRtaW4=",
"passphrase":"aXJvbnBvcnQ="
}
}

 

Testei com o curl com o exemplo abaixo, mas apresenta erro: 

 

curl -i -X GET --header 'Accept: application/json' http://localhost:6080/sma/api/v2.0/login -u admin:admin


HTTP/1.0 401 Permission denied
Server: EmailAPI/1.0
Date: Sun, 11 Aug 2019 17:48:26 GMT
Content-Type: application/json
Connection: close

 

{"error": {"message": "Permission denied.", "code": "401", "explanation": "401 = No permission -- see authorization schemes."}}

Hello,

 

Postman can still be useful as it will allow you to export the request in multiple ways (one being cURL) which can be used elsewhere. 

 

As an example, you could do something like this :

 

curl -sk -u admin:password https://<IPorFQDN>:<api-port>/sma/api/v2.0/config/system_time?device_type=sma
{"data": {"timezone": "America/New_York", "continent": ["America", "United States", "New_York"], "time": "Mon Aug 12 12:18:07 2019 EDT"}}

 

Thanks!

-Dennis M.

Create
Recognize Your Peers
Content for Community-Ad