I am using dexator to do a post request. I am updating a contact database.
Here is my code:
(defun upload-post (firstname email &optional first-line)
(dex:post NEW-LEAD-URL
:headers '((:content-type . "application/json"))
:content '(("email" . 'email)
("first_name" . firstname)
("custom_attributes" . '(("first_line" . first-line))))))
I get the error that firstname, email and first-line are defined but not used.
Notice that I tested quoting the email. That didn't work.
Why are the params being ignored?
CodePudding user response:
Because symbols inside a quoted list (email, firstname, first-line) won't evaluate.
Quote (') stops all evaluation, so values of variables firstname, email and first-line aren't used and you will send a request, where "email" has value email, "first_name" has value firstname and so on.
You could create that request list with list and cons, so all symbols are properly evaluated, or use backquote and comma:
(defun upload-post (firstname email &optional first-line)
(dex:post NEW-LEAD-URL
:headers '((:content-type . "application/json"))
:content `(("email" . ,email)
("first_name" . ,firstname)
("custom_attributes" . (("first_line" . ,first-line))))))
Just note that your naming is inconsistent- firstname vs first-line.
