Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Yes, Yurii, I did read your reply carefully. It is a very creative idea to create two columns called "where" and "operations" and update them with those values, but totally misses the point of what we are trying to do here!

As to where I got the information about "where" clause in update service: it is in your documentation: http://devcenter.appery.io/documentat...

In particular, please read the following sentence:
"Conditional multiple objects update

By mixing where and operations parameters, you can conditionally update multiple objects."

I use this ALL THE TIME on the client side, and it works perfectly well. I created a test app to prove it for you, here is the screenshot of the app.
Image

In this app, there is an update service that has a "where" clause and a "operations.$set" clause, as shown in the following screenshot:
Image
In the app, you can enter a name on one field, and a value in another, click on update. It will update ALL rows in the DB that have that name. It works perfectly fine.

I have shared the project with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, and the project is called TestWhereUpdate. You can play with it to satisfy that it works.

Now, the REAL question: Why does it work from the Client side REST service, but NOT from the server-side REST service?

Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Is there a way to update this thread from "Question" status to "Problem" status. This is definitely a problem for me now. I will be happy to open up a new thread, if required.

Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Thanks, Katya. I have also shared a Server Side test script with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. This script should be doing exactly what the client side does, but fails with the DBSP007 error. Script is called TestUpdateScript

Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Also shared the associated DB, just in case you need it.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Hi Kal,

Sorry, my bad.

So i've checked your server code script and here is worked code for you:

pre

var responseBody = {},
requestParams = {},
paramKeys = request.keys();

for (var key = 0; key < paramKeys&#46;length; key++) {
requestParams[paramKeys[key]] = request&#46;get(paramKeys[key]);
}

var dbId = "53eae11fe4b0d1037ddcbeed";

var bodyObject = {
"where": {"name":"joe"},
"operations": {"$set":{"value":"42_1"}}
};

var XHRResponse = XHR&#46;send("PUT", "https:&#47;&#47;api&#46;appery&#46;io/rest/1/db/collections/MyCollection/", {
"headers": {
"X-Appery-Database-Id": dbId,
"Content-Type": "application/json"
},
&#47;&#47;"body": {
&#47;&#47; "where": '{"name":"joe"}',
&#47;&#47; "operations": '{"$set":{"value":"42"}}'
&#47;&#47;}

"body": JSON&#46;stringify(bodyObject)
});
console&#46;log(XHRResponse);

/pre

Regards.

axkrishnan
Posts: 0
Joined: Tue Jul 29, 2014 12:14 am

(undocumented) database REST error code: 'DBSP007', description: 'Serialization error'

Aha! So you were on the right track with your first idea. There was a serialization error because it was expecting JSON and getting a string. Good catch!

Return to “Issues”