I have the following Emacs Lisp which builds up a query to Freebase. If I copy and paste the URL it generates into my browser OR a commandline curl
I get the results I would expect:
curl -X GET https://www.googleapis.com/freebase/v1/search?query=Oil%20on%20Canvas&filter=(any%20type%3avisual_art%2fvisual_art_medium) ... this works.
but I can't make it work from within Emacs:
(require 'url)
(defvar fb-url "https://www.googleapis.com/freebase/v1/search")
(defvar materials-type "(any type:visual_art/visual_art_medium)")
(defun fbquery (type str)
(let ((url-request-method "GET")
(url-request-data (concat "?query=" (url-hexify-string str)
"&filter=" (url-hexify-string type))))
(url-retrieve (concat fb-url)
(lambda (status) (switch-to-buffer (current-buffer))))))
(setq url-debug t)
(fbquery materials-type "Oil on Canvas")
I get back:
HTTP/1.0 400 Bad Request
... Your client has issued a malformed or illegal request. That's all we know.
.
Can you help?