This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-02
Channels
- # announcements (9)
- # asami (5)
- # babashka (16)
- # beginners (134)
- # chlorine-clover (3)
- # cider (15)
- # clojure (75)
- # clojure-australia (3)
- # clojure-europe (29)
- # clojure-nl (2)
- # clojure-uk (15)
- # clojured (4)
- # clojurescript (34)
- # cursive (9)
- # datomic (16)
- # duct (7)
- # events (4)
- # fulcro (2)
- # helix (5)
- # honeysql (4)
- # jobs (9)
- # lsp (55)
- # malli (31)
- # music (3)
- # re-frame (3)
- # reitit (1)
- # remote-jobs (1)
- # ring (3)
- # sci (5)
- # shadow-cljs (46)
- # specter (3)
- # tools-deps (60)
- # vim (5)
- # xtdb (15)
Hi everyone
I am trying to post JSON data via CURL from babashka/shell.
as following: curl -i -X POST "-H" "Content-Type: application/json" -d '{"text":"test"}' $SLACKURI
FIrst try and failure:
(shell/sh "sh" "-c" (clojure.string/join " " ["curl" "-i" "-X" "POST" "-H" "\\\"Content-Type: application/json\\\"" "-d" (str "'{\\\"text\\\":\\\"""test""\\\"}'") slack-uri]))))
=> "HTTP/2 400 \r\ndate: Fri, 02 Jul 2021 13:18:07 GMT\r\nserver: Apache\r\nstrict-transport-security: max-age=31536000; includeSubDomains; preload\r\nx-slack-backend: r\r\naccess-control-allow-origin: *\r\nx-frame-options: SAMEORIGIN\r\nvary: Accept-Encoding\r\nreferrer-policy: no-referrer\r\ncontent-type: text/html\r\nx-envoy-upstream-service-time: 9\r\nx-backend: main_normal main_canary_with_overflow main_control_with_overflow\r\nx-server: slack-www-hhvm-main-iad-6ilj\r\nx-via: envoy-www-iad-of34, haproxy-edge-fra-bdlo\r\nx-slack-shared-secret-outcome: shared-secret\r\nvia: envoy-www-iad-of34\r\n\r\ninvalid_payload"
Second try and failure:
(shell/sh "curl" "-i" "-X" "POST" "-H" "Content-Type: application/json" "-d" "'{\"text\":\"test\"}'" slack-uri)
=> {:exit 0, :out "HTTP/2 400 \r\ndate: Fri, 02 Jul 2021 13:25:44 GMT\r\nserver: Apache\r\nstrict-transport-security: max-age=31536000; includeSubDomains; preload\r\nx-slack-backend: r\r\naccess-control-allow-origin: *\r\nx-frame-options: SAMEORIGIN\r\nvary: Accept-Encoding\r\nreferrer-policy: no-referrer\r\ncontent-type: text/html\r\nx-envoy-upstream-service-time: 12\r\nx-backend: main_normal main_canary_with_overflow main_control_with_overflow\r\nx-server: slack-www-hhvm-canary-main-iad-8qva\r\nx-via: envoy-www-iad-fna1, haproxy-edge-fra-ot10\r\nx-slack-shared-secret-outcome: shared-secret\r\nvia: envoy-www-iad-fna1\r\n\r\ninvalid_payload", :err " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 32 0 15 100 17 42 47 --:--:-- --:--:-- --:--:-- 89\n"}
I am sure I tried a lot of other forms along the way… but none was successful 😞.I've got a similar script here. https://github.com/babashka/babashka/blob/11b066ae7096fd6306e430c4b13aa17c2a62a26b/.circleci/script/publish_artifact.clj
🙌 4
@U04V15CAJ Thanks, i forgot about curl wrapper. Works now!
Just curious, why babashka changed its release files extension to .tar.gz replacing .zip ?
@dharrigan I think you can do that as part of the bb.edn
.