<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I was getting this error too, I
      reverted to the previous version of cl+ssl in quicklisp by putting
      it in the local-projects directory.<br>
      <br>
      I've been meaning to report another problem I've had with the new
      version of drakma, it seems that when I POST login details to a
      site that I'm using it replies with a redirect, and then drakma
      tries to POST the login details to the redirected page rather than
      accessing it with a GET. I'll try and make a test case sometime
      this weekend.<br>
      <br>
      <br>
      On 21/03/13 21:41, Peter Kuchta wrote:<br>
    </div>
    <blockquote
cite="mid:CAJVHqnS1ROFcuUsWmUsWUTYoci3jc_6F8q1ngNqpKysiyJzrbw@mail.gmail.com"
      type="cite">Hi everybody,
      <div><br>
        <div>
          <div>I'm trying to POST some JSON data to a web service: </div>
          <div><br>
          </div>
          <div>        (ql:quickload :st-json)</div>
          <div>        (ql:quickload :cl-json)</div>
          <div>        (ql:quickload :drakma)</div>
          <div><br>
          </div>
          <div>        (defvar *rc* (merge-pathnames
            (user-homedir-pathname) ".apirc"))</div>
          <div><br>
          </div>
          <div>        (defvar *user*</div>
          <div>          (with-open-file (s *rc*)</div>
          <div>            (st-json:read-json s)))</div>
          <div><br>
          </div>
          <div>        (defvar api-url (st-json:getjso "url" *user*))</div>
          <div>        (defvar api-key (st-json:getjso "key" *user*))</div>
          <div>        (defvar api-email (st-json:getjso "email"
            *user*))</div>
          <div><br>
          </div>
          <div>        (setf drakma:*header-stream* *standard-output*)</div>
          <div><br>
          </div>
          <div>        (defvar *req* '(("dataset" . "tigge")</div>
          <div>                  ("step"    . "24")</div>
          <div>                  ("date"    . "20071001")</div>
          <div>                  ("time"    . "00")</div>
          <div>                  ("origin"  . "all")))</div>
          <div><br>
          </div>
          <div>        (format t "json:~S~%" (json:encode-json-to-string
            *req*))</div>
          <div><br>
          </div>
          <div>        (defun retrieve (api request)</div>
          <div>          (let* ((cookie-jar (make-instance
            'drakma:cookie-jar))</div>
          <div>                 (extra-headers (list (cons "From"
            api-email)</div>
          <div>                                      (cons "X-API-KEY"
            api-key)))</div>
          <div>                 (url (concatenate 'string api-url api
            "/requests"))</div>
          <div>                 (stream (drakma:http-request url</div>
          <div>                               :additional-headers
            extra-headers</div>
          <div>                               :accept "application/json"</div>
          <div>                               :method :post</div>
          <div>                               :content-type
            "application/json"</div>
          <div>                               :external-format-out
            :utf-8</div>
          <div>                               :external-format-in :utf-8</div>
          <div>                               :redirect 100</div>
          <div>                               :cookie-jar cookie-jar</div>
          <div>                               :content
            (json:encode-json-to-string request)</div>
          <div>                               :want-stream t)))</div>
          <div>              (st-json:read-json stream)))</div>
          <div><br>
          </div>
          <div>     (retrieve "/datasets/tigge" *req*)</div>
          <div><br>
          </div>
          <div>Unfortunately, I get an error, although the data seems to
            be encoded OK to JSON and the headers generated by drakma
            too, I think. Apparently something is wrong with the
            :content (the list of integers in the errors message is just
            the list of ASCII codes of the JSON encoded data).</div>
          <div><br>
          </div>
          <div>   
json:"{\"dataset\":\"tigge\",\"step\":\"24\",\"number\":\"all\",\"levtype\":\"sl\",\"date\":\"20071001\",\"time\":\"00\",\"origin\":\"all\",\"type\":\"pf\",\"param\":\"tp\",\"area\":\"70\\/-130\\/30\\/-60\",\"grid\":\"2\\/2\",\"target\":\"data.grib\"}"</div>
          <div><br>
          </div>
          <div>    POST /v1/datasets/tigge/requests HTTP/1.1</div>
          <div>    Host: <a moz-do-not-send="true"
              href="http://api.service.int">api.service.int</a></div>
          <div>    User-Agent: Drakma/1.3.0 (SBCL 1.1.5; Darwin; 12.2.0;
            <a moz-do-not-send="true" href="http://weitz.de/drakma/">http://weitz.de/drakma/</a>)</div>
          <div>    Accept: application/json</div>
          <div>    Connection: close</div>
          <div>    From: <a moz-do-not-send="true"
              href="mailto:me@gmail.com">me@gmail.com</a></div>
          <div>    X-API-KEY: 19a0edb6d8d8dda1e6a3b21223e4f86a</div>
          <div>    Content-Type: application/json</div>
          <div>    Content-Length: 193</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>    debugger invoked on a SIMPLE-TYPE-ERROR:</div>
          <div>      The value of CL+SSL::THING is #(123 34 100 97 116
            97 115 101 116 34 58 34</div>
          <div>                                  ...), which is not of
            type (SIMPLE-ARRAY</div>
          <div>                                                         
                (UNSIGNED-BYTE 8)</div>
          <div>                                                         
                (*)).</div>
          <div><br>
          </div>
          <div>Any idea what's wrong with this code? Many thanks in
            advance.</div>
          <div><br>
          </div>
          <div>Best regards,</div>
        </div>
      </div>
      <div>Piotr</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
drakma-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:drakma-devel@common-lisp.net">drakma-devel@common-lisp.net</a>
<a class="moz-txt-link-freetext" href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>