Created
November 23, 2016 06:27
-
-
Save scar45/ffd053cbee1d1190c9d4a92b236febd1 to your computer and use it in GitHub Desktop.
Send a bash variable through a cURL post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
header="Content-Type: application/json" | |
FILENAME="/media/file.avi" | |
request_body=$(< <(cat <<EOF | |
{ | |
"jsonrpc": "2.0", | |
"method": "Player.Open", | |
"params": { | |
"item": { | |
"file": "$FILENAME" | |
} | |
} | |
} | |
EOF | |
)) | |
curl -i -X POST -H "$header" -d "$request_body" http://192.167.0.13/jsonrpc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment