Skip to content

Instantly share code, notes, and snippets.

@DinoChiesa
Created April 17, 2014 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinoChiesa/11006228 to your computer and use it in GitHub Desktop.
Save DinoChiesa/11006228 to your computer and use it in GitHub Desktop.
Invoke Apigee Edge Mgmt API to list APIs, from elisp
(defun my-produce-basic-auth-header-value (username password)
"produce an HTTP Basic Auth header value for a given username and password."
(concat "Basic "
(base64-encode-string
(concat username ":" password))))
(request
"https://api.enterprise.apigee.com/v1/o/deecee/apis"
:headers `(("authorization" . ,(my-produce-basic-auth-header-value username password))
("accept" . "application/json"))
:type "GET"
:parser 'buffer-string
:success (function* (lambda (&key data &allow-other-keys)
(when data
(with-current-buffer (get-buffer-create "*request demo*")
(erase-buffer)
(insert data)
(pop-to-buffer (current-buffer))))))
:error (function* (lambda (&key error-thrown &allow-other-keys&rest _)
(message "Got error: %S" error-thrown))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment