Where clause on Custom Object returns 'Internal Server Error'

62 views
Skip to first unread message

brian blankenship

unread,
Mar 30, 2012, 4:10:06 PM3/30/12
to cocoafi...@googlegroups.com
I get 'Internal Server Error - the Cocoafish team has been notified of this error' when adding a where clause to query a custom object.

Example of my where clause that I send in my xhr:

'where={"title":"Generic Content Title"}'

In Appclerator Titanium, this is: xhr.send('where={"title":"Generic Content Title"}');

When excluding this param, it returns results successfully.

Thanks,

Brian

Pratik Patel

unread,
Mar 30, 2012, 4:58:09 PM3/30/12
to cocoafi...@googlegroups.com
Make sure you encode the where clause.

-----------------------------------------------------------
CTO, TripLingo (http://www.triplingo.com)
Twitter: prpatel
Skype: prpatel

brian blankenship

unread,
Mar 31, 2012, 9:14:22 AM3/31/12
to cocoafi...@googlegroups.com
Thanks, Pratik.  I get the same results when encoding the where clause, trying various approaches of doing that (below is one).  Is the encoded where clause rather to be appended to the url itself after the API key?

var encodedData = Ti.Network.encodeURIComponent('where={"title":"Generic Content Title"}');

xhr.send(encodedData);

Wei Kong

unread,
Mar 31, 2012, 2:45:04 PM3/31/12
to cocoafi...@googlegroups.com
Hi Brian,

You did a post, can you please try get instead? query.json should be HTTP GEt

Thanks,
Wei

___________________
Wei Kong
Co-Founder | Cocoafish
mobile: 415-533-1853

brian blankenship

unread,
Mar 31, 2012, 5:44:06 PM3/31/12
to cocoafi...@googlegroups.com
Wei,
Actually, no, I've had "GET" the whole time since it's a query only. There still could be something else I'm doing wrong for sure though. Thanks.

brian blankenship

unread,
Apr 1, 2012, 1:12:07 PM4/1/12
to cocoafi...@googlegroups.com
I got it to work.  I just wasn't properly encoding the right portions of the url when appending to the base url.

Thanks.

Juan Bermudez

unread,
Apr 13, 2012, 3:00:06 PM4/13/12
to cocoafi...@googlegroups.com
Brian, just had the same issue, any  advice on what you did to fix it?

brian blankenship

unread,
Apr 14, 2012, 6:02:49 AM4/14/12
to cocoafi...@googlegroups.com
Juan,
    I just had to construct the url as follows...

'https://api.cocoafish.com/v1/objects/' + class_name + "/query.json?key=" + YOUCFAPPKEY +'&'+'where=’ + Ti.Network.encodeURIComponent('{"title":"Generic Content Title"}');

--
Brian Blankenship, PMP
Senior Solutions Provider
Clearly Innovative, Inc.
An Appcelerator Titanium Gold Partner




signature0.tiff

Juan Bermudez

unread,
Apr 16, 2012, 2:58:29 PM4/16/12
to cocoafi...@googlegroups.com
Thanks Brian,

I think I ran into a bug. I have other queries for predefined object and they work perfect when using  the contained in operator $in.

But on a custom object it gives back an internal server error when i try to search $in a field that is a string:
https://api.cocoafish.com/v1/objects/customer/query.json?key=MY_API_KEY&where=URLEncoded({"user_id":"4f74d5d2356f4e75ac001c47", "first_name": {"$in": "p" } })

Let me know if you have encountered this.

Thanks,
Juan

Wei Kong

unread,
Apr 16, 2012, 3:18:12 PM4/16/12
to cocoafi...@googlegroups.com
Hi Juan, I wil ltake a look.

Wei

___________________
Wei Kong
Co-Founder | Cocoafish
mobile: 415-533-1853

Reply all
Reply to author
Forward
0 new messages