Chapter 2: Curl Usage Examples

This chapter provides examples of how to use Curl to interact with the REST API. Curl is a command-line tool available on most platforms and can be used to send requests and view responses directly from the cOS Core API. These examples are intended as a quick way to get started before integrating the REST API into applications or scripts.

Example 1, Without Authentication

curl https://192.168.1.1/api/about

Example 2, With Authentication

curl https://192.168.1.1/api/about --user MyUser:MyPassword

Example 3, Posting Data

curl https://192.168.1.1/api/oper/userauth -d
"ip=192.168.1.100&interface=lan&session_timeout=3600
&idle_timeout=1800&username=MyUser&groups=MyGroup"

Example 4, Deleting Data

curl -X DELETE "https://192.168.1.1/api/oper/blacklist?host=10.10.10.10"

Example 5, Adding a Source and Destination Host To Blacklist

curl http://192.168.1.1/api/oper/blacklist -d 
"host=198.51.100.10&dest=203.0.113.52"