Making a REST Client

with Common Lisp

I won't expend effort defending using Common Lisp for these tutorials. Enjoy.

Preliminaries

I'm basically a third-class citizen, a Vim user. It's exotic enough that VSCode, Atom, Sublime, etc. users ask me why I use something arcane. Yet, I still garner the disdain of those in the Church of Emacs... especially in the Lisp world.

If you read a lot of other CL tutorials they're going to tell you to setup Emacs + SLIME. I won't, use whatever you want. All that's important is that you have at least a text editor and access to a terminal on a Linux machine, or something close enough.

Now boot up your terminal and type in the following commands.

you@ether:~/$ sudo apt-get install sbcl  
you@ether:~/$ wget https://beta.quicklisp.org/quicklisp.lisp  
you@ether:~/$ sbcl --load quicklisp.lisp

Now in the SBCL REPL that is loaded type the following commands

* (quicklisp-quickstart:install)  
* (quit)

Note: (In the SBCL REPL "*" is the same as $ in your terminal)

And that's it, you're ready to start developing.

Implementing a REST API Client

We'll be building a REST API client for my employer, Transloadit, because well it'll make my life easier. Your mileage may vary.

~/client.lisp

;;;; Transloadit REST Client ver. -1.0.0

;;; Load libraries
(load "~/quicklisp/setup.lisp") ;; Load QL package manager
(ql:quickload :drakma) ;; Load up drakma HTTP client

;;; Setup placeholder functions for interacting with Transloadit API

;;; Assembly Functions
(defun create-assembly (:params p &optional :signature s)   
    ())
(defun get-assembly ())
(defun cancel-assembly ())
(defun replay-assembly ())
(defun list-assemblies ())

;;; Assembly Notification Functions
(defun replay-notification ())
(defun list-notifications ())

;;; Billing Functions
(defun retrieve-bill (year month signature))

;;; Template Functions
(defun create-template())
(defun get-template())
(defun update-template())
(defun delete-template())
(defun list-templates)

Quicklisp is just a package manager. Drakma is just an HTTP client. Transloadit's API is just REST for media