Skip to content

Instantly share code, notes, and snippets.

@jwalsh
Created March 19, 2012 20:55
Show Gist options
  • Save jwalsh/2127041 to your computer and use it in GitHub Desktop.
Save jwalsh/2127041 to your computer and use it in GitHub Desktop.
#!/bin/sh
# 1. Define a base set of credentials with APPID and APPSECRET
. ~/.facebookrc
# APPID=
# APPSECRET=
function init {
echo
echo
}
function header {
echo =================================
echo $1
}
function report {
echo $1
echo
}
function token {
header "Getting access token..."
TOKEN=$(curl -s -F grant_type=client_credentials \
-F client_id=${APPID} \
-F client_secret=${APPSECRET} \
https://graph.facebook.com/oauth/access_token)
report $TOKEN
}
# Base use of Open Graph for pulling the data
function overview {
header "Getting overview..."
curl -s "https://graph.facebook.com/${APPID}?$TOKEN"
report "Getting test users..."
LOG=/tmp/`basename $0`$$.log
curl -s "https://graph.facebook.com/${APPID}/accounts/test-users?$TOKEN" > $LOG
report See $LOG for details
}
# http://developers.facebook.com/docs/test_users
function test_user {
header "Making test user..."
# Documentation: http://developers.facebook.com/docs/test_users/
# https://graph.facebook.com/APP_ID/accounts/test-users?
# installed=true
# &name=FULL_NAME
# &locale=en_US
# &permissions=read_stream
# &method=post
# &access_token=APP_ACCESS_TOKEN
# Don't assume the application has been installed; if installed it
# would still show the diff between permission sets.
curl -s -d '' "https://graph.facebook.com/${APPID}/accounts/test-users?installed=false&$TOKEN" | prettify_json.rb
}
init
token
test_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment