Curl, what is it? Curl is a command line tool that allows you to transfer data from server to another device using a wide range of supported protocols (HTTP, FTP, TFTP, SMTP to name a few). The default protocol curl uses is HTTP. For us network folks, this makes life a little easier. The main reason I am writing about this is to explain some of the curl capabilities for us to consume network device/appliance application programming interfaces (APIs) in later posts.
Since we will be using curl in later posts to test/consume APIs it is important to understand HTTP methods that we can use. It is also important to understand what the CRUD model and RESTful applications are/mean.
So let's start with a brief overview of all 3. HTTP methods allow us to to send and/or retrieve information between applications. CRUD is a model that is followed by most APIs that are built that is an acronym for (Create, Read, Update, Delete), which allows us to manage resources via RESTful APIs. REST is an acronym for REpresentational State Transfer, which essentially means we we are transferring a representation of some resource between two devices. So in short, RESTful APIs are services that implements the REST standards that allow us to utilize the CRUD model.
So, here are how CRUD & HTTP methods relate to each other:
HTTP POST = Create
HTTP GET = Read
HTTP PUT = Update
HTTP DELETE = Delete
Note that there are other HTTP methods, but these are the most commonly used ones.
Ok so now that we have a better understanding of how the 3 correlate with each other, let's breakdown curl a bit more:
Curl is a great tool that quickly lets you test consuming an API. In some past experiences I have used curl to quickly grab (GET/Read) a unique identity string that I needed to place in a python automation script. Most network appliances have software development kits (SDKs) which provide a great way to understand the capabilities you have when consuming the respective APIs.
Stay tuned for further posts with curl demos & command breakdowns. Cheers!