Created
December 23, 2015 15:09
-
-
Save hideokamoto/a9bb2c5b8c2aae62e8bb to your computer and use it in GitHub Desktop.
様々なコマンド達を何も考えずにWP REST APIとつないで遊ぶ ref: http://qiita.com/motchi0214/items/8a4e9f37d298777adee1
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/sh | |
URL=${1} | |
if [ "${URL}" = "" ]; then | |
echo "Please set URL" | |
exit 1 | |
fi | |
curl -XGET ${URL}"wp-json/wp/v2/posts" | jq ".[0].title.rendered" | cowsay |
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 wp-cowsay.sh http://hoge.example.com/ |
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/sh | |
URL=${1} | |
if [ "${URL}" = "" ]; then | |
echo "Please set URL" | |
exit 1 | |
fi | |
curl -XGET ${URL}"/wp-json/wp/v2/posts/" | jq ".[0].content.rendered" | mecab |
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/sh | |
URL=${1} | |
if [ "${URL}" = "" ]; then | |
echo "Please set URL" | |
exit 1 | |
fi | |
ID=${2} | |
if [ "${ID}" = "" ]; then | |
echo "Please set POST ID" | |
exit 1 | |
fi | |
COMMENT=`matsuya` | |
curl -XPOST ${URL}"/wp-json/wp/v2/comments/" -d "post=${ID}" -d "content=${COMMENT}" |
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 wp-cowsay.sh http://hoge.example.com/ 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment