Question

Hi I'm using CustomObject to bulid friends list but I'm facing below problem. When I try to push a number to an array field it returns null value and the field is not updated but if I add it as a normal field (not pushing to array) it works fine.

Below is my code:

QBCustomObject friendsList = new QBCustomObject();
friendsList.setClassName("Friends");
HashMap<String, Object> fields = new HashMap<String, Object>();
fields.put("push[friendsId][]", "00001111");
friendsList.setFields(fields);

and logcat shows below api request:

https://api.quickblox.com/data/Friends.json?push[friendsId][]=00001111

but if I use below code it works but not append to array. It adds new record:

fields.put("friendsId", "00001111");
friendsList.setFields(fields);

Is there anything wrong with my way?

Was it helpful?

Solution

To update your record, your URL should look like

https://api.quickblox.com/data/Friends/id.json?push[friendsId][]= 00001111,

where id is a record id.

For example,

https://api.quickblox.com/data/Friends/111c0ec5535c12669c000721.json?push[friendsId][]= 00001111

Did my answer helped you ?

OTHER TIPS

You can rewrite the whole record. Don't try to add an object separately into an array, update the whole record.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top