Post Reply

[Q][JS] Parse Cloud Code problem.

12th February 2014, 01:52 PM   |  #1  
IzaacJ's Avatar
OP Recognized Developer
Flag Eskilstuna
Thanks Meter: 82
 
619 posts
Join Date:Joined: Sep 2008
Donate to Me
More
Hello.

I'm working on a project where I need to store some information from the Windows Phone store in my Parse database, but since I'm new to both Parse and JavaScript (only supported language for Cloud Code) I need some help.

There seem to be something wrong with a property, but more than that I can't get, not which row or anything.

My code at the moment is this:

Code:
Parse.Cloud.job("getWP8Apps", function(request, response) {
  Parse.Cloud.useMasterKey();
  var query = new Parse.Query("developer");
  query.each(function(results) {
    Parse.Cloud.httpRequest({
      url: 'http://zunderstorehost.azurewebsites.net/api/WP8StoreAppList/Publisher/' + results.get("publisherName"),
	  success: function(httpResponse) {
	    var apps = httpResponse.data;
		for(var app in apps) {
		  var application = Parse.Object.extend("application");
		  var newApp = new application();
		  newApp.save({
		  categories: app.categories,
		  guid: app.guid,
		  haslivetile: app.haslivetile,
		  icon: app.icon,
		  mame: app.name,
		  offers: app.offers,
		  publisher: app.publisher,
		  publisherid: app.publisherid,
		  rating: app.rating,
		  ratingCount: app.ratingcount,
		  releaseDate: app.releasedate,
		  version: app.version
		  }, {
		    success: function(newApp){ console.log(app.name + " saved!"); },
		    error: function(newApp, error) {console.error("Something failed: " + error.description); }});
		}
	  },
	  error: function(error) {
	    console.error("Something failed: " + error.description);
	  }
	});
  });
});
The developer object that I'm fetching from the storage is a small collection of items containing some general information about the different developers included in this, amongst that information, their Windows Phone Store Publisher Name which is to be used to fetch a list of their published applications.

The application object is a json converted class through the Parse Class Import function (that function converts the Json to a valid table structure for data storage of the result).

So, anyone with some ideas on what could be the issue here?

Any help is highly appreciated!

NOTE: This code is to run in the cloud, not in the app. Thats why I posted this in the web section. If it fits better somewhere else, feel free to move it.
Post Reply Subscribe to Thread

Tags
javascript, json, parse
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes