jeudi 23 juin 2016

Database fields not updating through REST API after migrating to ParseServer from parse.com


I migrated from parse.com to a hosted ParseSever. Most of the things are working, however I found that for one class, the fields are not updated. The HTTP request returns 200 in logs and in Python, updatedAt field shows the recent timestamp, but the fields are not changed. In the python code and its printout below, fields field1 and field2 continue to show old values even when updatedAt and HTTP response check out. Updates to other classes from REST API are generally working (have not checked exhaustively). Updates from SDK are working. Was working flawlessly on parse.com. ACL of class and entries are public.

def updateObjectWithId(self,objectId, objectJson):
        self.connection.connect()
        if(objectId == ""):
            self.connection.request('POST','/parse/classes/'+self._className,objectJson,
                    {
                    "X-Parse-Application-Id": self.appId,
                   "X-Parse-Master-Key": self.masterApiKey
                                })
        else:
            print "ParseArchiver.updateObjectWithId: id: ", objectId, " of Class: ", self._className, " with json: ", objectJson
            self.connection.request('PUT','/parse/classes/'+self._className+'/'+objectId,objectJson,
                    {
                    "X-Parse-Application-Id": self.appId,
                   "X-Parse-Master-Key": self.masterApiKey
                                })
        result = json.loads(self.connection.getresponse().read())
        time.sleep(ParseArchiver.ParseSleepTime)
        print "*** ParseArchiver.updateObjectWithId: Result object is:",result

        return

The output:

PredictionObject.write(): updating existing object with ID:  On6AdEnPVb
ParseArchiver.updateObjectWithId: id:  correct_id  of Class:  correct_class  with json:  {"field1": ["2016-06-07T22:00:00.000Z|0.267835319042|-0700", "2016-06-08T10:00:00.000Z|0.446276366711|-0700", "2016-06-08T22:00:00.000Z|0.778348565102|-0700", "2016-06-09T10:00:00.000Z|0.00348118506372|-0700", "2016-06-09T22:00:00.000Z|0.0183897037059|-0700", "2016-06-10T10:00:00.000Z|0.562650620937|-0700", "2016-06-10T22:00:00.000Z|0.079613097012|-0700", "2016-06-11T10:00:00.000Z|0.562650620937|-0700", "2016-06-11T22:00:00.000Z|0.0199579093605|-0700", "2016-06-12T10:00:00.000Z|0.629606068134|-0700", "2016-06-12T22:00:00.000Z|0.292343884706|-0700", "2016-06-13T10:00:00.000Z|0.0342484489083|-0700", "2016-06-13T22:00:00.000Z|0.0746899694204|-0700", "2016-06-14T10:00:00.000Z|0.0594595149159|-0700", "2016-06-14T22:00:00.000Z|0.424203515053|-0700", "2016-06-15T10:00:00.000Z|0.0349752865732|-0700", "2016-06-15T22:00:00.000Z|0.00455725379288|-0700", "2016-06-16T10:00:00.000Z|0.0987700968981|-0700", "2016-06-16T22:00:00.000Z|0.30742970109|-0700", "2016-06-17T10:00:00.000Z|0.0781866833568|-0700", "2016-06-17T22:00:00.000Z|0.367497861385|-0700", "2016-06-18T10:00:00.000Z|0.225806906819|-0700", "2016-06-18T22:00:00.000Z|0.0179004631937|-0700", "2016-06-19T10:00:00.000Z|0.11387591809|-0700", "2016-06-19T22:00:00.000Z|0.103792026639|-0700", "2016-06-20T10:00:00.000Z|0.710064172745|-0700", "2016-06-20T22:00:00.000Z|0.728509664536|-0700", "2016-06-22T10:00:00.000Z|0.140641510487|-0700"], "uid": "correct_uid", "field2": ["2016-06-20T22:00:00.000Z|0.728509664536|-0700", "2016-06-22T10:00:00.000Z|0.140641510487|-0700"]}
*** ParseArchiver.updateObjectWithId: Result object is: {u'updatedAt': u'2016-06-22T16:38:55.690Z'}

Aucun commentaire:

Enregistrer un commentaire