Skip to content

Instantly share code, notes, and snippets.

@emresebat
Created February 25, 2015 19:32
Show Gist options
  • Save emresebat/48d43ebd6f83ccd3f0c6 to your computer and use it in GitHub Desktop.
Save emresebat/48d43ebd6f83ccd3f0c6 to your computer and use it in GitHub Desktop.
BaasBox Parse data fetch plugin
var getParseHeader = function () {
return {
"X-Parse-Application-Id": "ENTER_APP_ID",
"X-Parse-REST-API-Key": "ENTER_API_KEY",
"Content-Type": "application/json"
};
};
var getParseUrl = function (className) {
return "https://api.parse.com/1/classes/" + className;
};
var fetchData = function (className, includes, skip, limit) {
var url = getParseUrl(className);
if (includes) {
url += encodeURIComponent("?include=" + includes);
}
if (skip && limit) {
url += encodeURIComponent("&skip=" + skip + "&limit=" + limit);
}
Box.log(url);
var result = Box.WS.get(url,
{
headers: getParseHeader()
});
return result.body.results;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment