Created
May 2, 2011 19:31
-
-
Save caefer/952206 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| APP_ID=$1 | |
| APP_SECRET=$2 | |
| ## aquire an app login access token | |
| TOKEN_URL="https://graph.facebook.com/oauth/access_token?client_id="$APP_ID"&client_secret="$APP_SECRET"&grant_type=client_credentials" | |
| TOKEN=`curl -s $TOKEN_URL` | |
| ## create a secret event | |
| EVENT_DATA="name=ClosedTestEvent&start_time=1272718027&privacy_type=CLOSED&"$TOKEN | |
| EVENT_URL="https://graph.facebook.com/"$APP_ID"/events" | |
| EVENT_ID=`curl -s -d $EVENT_DATA $EVENT_URL | sed 's/[^0-9]//g'` | |
| echo "EVENT ID: "$EVENT_ID | |
| ## read the event and dump it | |
| EVENT_URL="https://graph.facebook.com/"$EVENT_ID"?"$TOKEN | |
| EVENT=`curl -s $EVENT_URL` | |
| echo "SHOULD BE CLOSED: "$EVENT | |
| ## updating the event with a new privacy_type and name | |
| EVENT_DATA="name=OpenTestEvent&privacy_type=OPEN&"$TOKEN | |
| EVENT_URL="https://graph.facebook.com/"$EVENT_ID | |
| RES=`curl -s -d $EVENT_DATA $EVENT_URL` | |
| echo " " | |
| ## re-read the event and dump it again | |
| EVENT_URL="https://graph.facebook.com/"$EVENT_ID"?"$TOKEN | |
| EVENT=`curl -s $EVENT_URL` | |
| echo "SHOULD BE OPEN: "$EVENT | |
| echo "NAME IS CHANGED THOUGH..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment