Skip to content

Instantly share code, notes, and snippets.

@hideokamoto
Created December 23, 2015 15:09
Show Gist options
  • Save hideokamoto/a9bb2c5b8c2aae62e8bb to your computer and use it in GitHub Desktop.
Save hideokamoto/a9bb2c5b8c2aae62e8bb to your computer and use it in GitHub Desktop.
様々なコマンド達を何も考えずにWP REST APIとつないで遊ぶ ref: http://qiita.com/motchi0214/items/8a4e9f37d298777adee1
#!/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
$ /bin/bash wp-cowsay.sh http://hoge.example.com/
#!/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
#!/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}"
$ /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