HTTPie

HTTPie is a command line HTTP client, just like curl but more user friendly.

  • Windows - can be installed with pip (requires Python 3.x). By the way, this is cross-platform solution.
  • Linux - can be installed with most of package managers.
  • macOS - can be installed with Homebrew or MacPorts.

Check docs for details.

Usage

http <url> <body params>

for Bash/Zsh/etc.

# set url variable to type less and make command more readable
export WEBHOOK_URL="https://discord.com/api/webhooks/203019812404264973/rptBmYgoehu70kw2rItSlhRqKi7kMJh1bM2KCUUD2vR6grZckvtdl62h4xR7XWUS5463"
http -j post $WEBHOOK_URL username="Cat" content="meow" embeds:='[{"title": "Cool!"}]'
# -j/--json parameter sets json header, but it's used by default so it can be ommited.
http post $WEBHOOK_URL username="Cat" content="meow" embeds:='[{"title": "Cool!"}]'
# Default method is GET, but adding data makes it switch to POST so you can ommit it too.
http $WEBHOOK_URL username="Cat" content="meow" embeds:='[{"title": "Cool!"}]'

Depends on type of value you have to use different separators:

  • = - text.
  • := - raw JSON value. Use it for array, number, boolean and nested values.

Also, if you don't want to mess with these and would like to just pass raw body, like can be done in curl, use the next approach:

echo '{"username": "Cat", "content": "meow", "embeds": [{"title": "Cool!"}]}' | http $WEBHOOK_URL

PowerShell

# In PowerShell you have to escape " with \ inside strings, so body string be parsed correctly.
$WEBHOOK_URL = "https://discord.com/api/webhooks/203019812404264973/rptBmYgoehu70kw2rItSlhRqKi7kMJh1bM2KCUUD2vR6grZckvtdl62h4xR7XWUS5463"
http $WEBHOOK_URL username="Cat" content="meow" embeds:='[{\"title\": \"Cool!\"}]'

# Also you can just pass raw json body:
'{"username": "Cat", "content": "meow", "embeds": [{"title": "Cool!"}]}' | http $WEBHOOK_URL

Command Prompt (cmd.exe)

REM Notice escaped double quotes around values and none around link
SET WEBHOOK_URL=https://discord.com/api/webhooks/203019812404264973/rptBmYgoehu70kw2rItSlhRqKi7kMJh1bM2KCUUD2vR6grZckvtdl62h4xR7XWUS5463
http %WEBHOOK_URL% username="Cat" content="meow" embeds:="[{\"title\": \"Cool!\"}]"

REM Outer quotes are skipped due to cmd parsing
echo {"username": "Cat", "content": "meow", "embeds": [{"title": "Cool!"}]} | http %WEBHOOK_URL%