From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mortimer Cladwell Newsgroups: gmane.lisp.guile.user Subject: http-request bearer token syntax for Twitter v2 api Date: Wed, 12 Oct 2022 06:30:51 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37311"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Oct 12 12:31:33 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiZ1O-0009Uo-Pd for guile-user@m.gmane-mx.org; Wed, 12 Oct 2022 12:31:30 +0200 Original-Received: from localhost ([::1]:55940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiZ1N-0005Q2-Ky for guile-user@m.gmane-mx.org; Wed, 12 Oct 2022 06:31:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiZ10-0005Pa-Pp for guile-user@gnu.org; Wed, 12 Oct 2022 06:31:06 -0400 Original-Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:44598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiZ0y-0005fE-VO for guile-user@gnu.org; Wed, 12 Oct 2022 06:31:06 -0400 Original-Received: by mail-pj1-x1032.google.com with SMTP id t10-20020a17090a4e4a00b0020af4bcae10so1619791pjl.3 for ; Wed, 12 Oct 2022 03:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=LO0ZZfa4EKOE6RklCTi2BkKdPRgZJQbncpcbZKhY9TA=; b=Qao0Ag5rB+/cBqy5KTmbylMq/qsMlAHzIMSo7S9xoJtLQFH3dt5ki3T9WwKvnh1372 INv/r+47T1F8/KeE2Cx1ggbsr/C0enfgG1pFlkz+Vk1dE7A9ecWkxodB4ZxjaMreW1zy +cZm+BMKqARDH9bO/3QA/0DpU9dbrwx3LBglIrIHL0dt5Jd6eRR1X/cGakS9xHzG8a0w 7+jsjI1JlF0ge8yLZ0UzhE0TDr96j/wSx9/hJMaI0Df1xuFvoiBRmpVGYQSNtgECdREt NkBBLQIILh8SkXxI/o46mViSAP9jANTsQ5YUqTOnV/pNKYGoEs3ZafIB3RWJfKjMaVBv vdhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LO0ZZfa4EKOE6RklCTi2BkKdPRgZJQbncpcbZKhY9TA=; b=wvX2UuVe9BlUWMb44jMNIr6LcDXSLJ047kWZqbrQ7k0NQ4QYnX0jvp5SfTujMvuK1K vUmmQk/hNpIyN/Ame246wh2m8Xd7ibqh8WF06NZsvyolSZlCoacSLTcADFariyK+e2IR Ljdm3yPOPNaFgZKsGThr50KlVVolRE07NWMawOAcXSngmZlPZm5Kw1cI8jYxsx3F13wc 5XnWFGI8u5nkvEIbxU9LqdkEtH1FmFMSl+ZtCZjcj2EB4nIoucmaIzkQVRbDK8kpT2Ll rvqkQzpqDpmcUVNFHIo5QSnuuINV35o4SFwG/7a6UeRtUV6cPFqwwC37iv4EkJnSSiiF Zt4w== X-Gm-Message-State: ACrzQf2ax3oZuBkihk/LWUeQr5GFrvSVoURe+HVRtCcT4D2hJBTyg/dU IAtvRhyk/t12RHNI1QF72FARX3qUMYC/XzE6fuqjy5QLjTq+IQ== X-Google-Smtp-Source: AMsMyM6swzU5/PTTVuZgM6VZCaVE9eq8t+n5km4FI7jDfz5mgxHkNYyEr5FtfLxyGyGUavj/UNTcbgdO7AMIiYjefVY= X-Received: by 2002:a17:903:1110:b0:178:9f67:b543 with SMTP id n16-20020a170903111000b001789f67b543mr29041171plh.131.1665570662979; Wed, 12 Oct 2022 03:31:02 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=mbcladwell@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18618 Archived-At: Hi, Has anyone successfully submitted a bearer token to Twitter v2 api using http-request? What syntax did you use? Without success I have tried many permutations/splellings/capitalizations of: (let* ( (uri "https://api.twitter.com/2/tweets") (data "{\"text\":\"Hello world!\"}") (my-token (string-append "bearer " "abcde....myaccesstoken")) (my-headers `((Content-type . "application/json")(Authorization . ,my-token)) ) ) (receive (response body) (http-request uri #:method 'POST #:body data #:headers my-headers) (pretty-print response) (pretty-print (utf8->string body)))) the error body: "{\"errors\":[{\"message\":\"Requests with bodies must have content-type of application/json.\"}],\"title\":\"Invalid Request\",\"detail\":\"One or more parameters to your request was invalid.\",\"type\":\" https://api.twitter.com/2/problems/invalid-request\"}" I am not sure the "Requests with bodies must have content-type of application/json." is the real error. I think it is "Authorization: bearer abcde....". Can http-request handle a bearer token? I know my tokens are valid because I can successfully submit them using curl. Thanks Mortimer