Created
April 17, 2014 19:24
-
-
Save DinoChiesa/11006228 to your computer and use it in GitHub Desktop.
Invoke Apigee Edge Mgmt API to list APIs, from elisp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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