json - How to curl post data with special characters @ and < -
i using slack app send message slack channel using incoming webhook. , have created bat file , use curl post message. thing if want mention someone, need <@username>
in post data.
the post request looks this
content-type: application/json
post https://hooks.slack.com/services/token?{"text":"<@username>this test message"}
with curl, have
curl -h "content-type: application/json" -x post "https://hooks.slack.com/services/token" -d "{\"text\":\"<@username>this test message\"}"
the error message got
0<@username 1>this system cannot find file specified
i realized @username
symbol makes curl load data given file "username"
i tried suggestion can find, e.g. encode post data curl -h "content-type: application/json" -x post "https://hooks.slack.com/services/token" -d "{\"text\":\"%3c%40username%3ethis test message\"}"
i got message
c0usernameethis test message
does can me this? otherwise might give curl , try else.
thanks.
https://curl.haxx.se/docs/manpage.html:
--data-raw
: (http) posts data -d, --data without special interpretation of @ character.
Comments
Post a Comment