Created
          February 25, 2015 19:32 
        
      - 
      
 - 
        
Save emresebat/48d43ebd6f83ccd3f0c6 to your computer and use it in GitHub Desktop.  
    BaasBox Parse data fetch plugin
  
        
  
    
      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
    
  
  
    
  | 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