Skip to content

Instantly share code, notes, and snippets.

@tcr
Last active December 14, 2015 23:29
Show Gist options
  • Save tcr/5166129 to your computer and use it in GitHub Desktop.
Save tcr/5166129 to your computer and use it in GitHub Desktop.
/** A low-level look at an HTTP API */
// Make the GET request to the Facebook API.
Facebook.get("me/notifications?limit=1", access_token);
Facebook.match(onNotification, "data", JSON_ARRAY, "title"); // "data" key, find ARRAY, identify each "title" key
Facebook.match(onError, "error");
Facebook.request();
// Make the GET request to the Facebook API.
Facebook.post("me/feed", access_token);
Facebook.field("message", "I just got the high score!")
Facebook.request();
/** High-level code */
char *access_token = NULL;
void loop() {
if (access_token == NULL) {
int err = Lifegraph.readCard(&access_token);
} else {
Facebook.postStatus("I just got the high score!", access_token);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment