Page 3 of 4

Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 7:50 pm
by Kateryna Grynko

Thank you, we'll take a look.


Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 7:53 pm
by Bad Addy

This is how the request looks

https://api.appery.io/rest/1/db/colle...

This, with the below code brings all rows back, not just the ones with 6 in the sid coll.

url: 'https://api.appery.io/rest/1/db/colle...',
dataType: 'json',
contentType: 'application/json',
data: {
where: {sid: sid}
},


Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 8:12 pm
by Kateryna Grynko

What is 'sid'? Is it a variable?
Parameter 'where' should have this format:pre{"sid": "sid"}/prehttp://docs.appery.io/documentation/b...


Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 8:19 pm
by Bad Addy

The first sid is the name of the colume, the second is a variable. If I enter it like this, in the url, it says 'sid' instead of the number '6' ?


Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 9:38 pm
by Bad Addy

I have had another play, and still I cannot make it work. Something is wrong with how its sent to the database.

If I add JSON.stringify() it comes back empty, if i remove it, it comes back with all the collection.

What am I doing wrong ?


Using ?WHERE= in URL database call

Posted: Tue Jan 28, 2014 10:32 pm
by Kateryna Grynko

You don't need to use codeJSON.stringify()/code, if 'sid' is a variable then use parameter 'where' this way:prewhere: {"sid": sid}/pre


Using ?WHERE= in URL database call

Posted: Wed Jan 29, 2014 8:18 am
by Bad Addy

Yes, I have tried this, but still it brings back all rows, and not only the rows where sid = 6

This is what is wrong :(


Using ?WHERE= in URL database call

Posted: Wed Jan 29, 2014 9:02 am
by Bad Addy

I have tried to change the database col from number to string, and back to number, thinking it was that, as the above code from Igor seemed to work.

But still it brings back all records, regardless of the number in sid col


Using ?WHERE= in URL database call

Posted: Wed Jan 29, 2014 11:04 am
by Maryna Brodina

Hello! Sorry, but we don't see ajax in your urVoice project. There is only service with request to DB and in where parameter you set pre{"area_type" : {ar}. "area" : {an}}/preit's not correct. What do you mean on {ar} and {an}?


Using ?WHERE= in URL database call

Posted: Wed Jan 29, 2014 11:29 am
by Bad Addy

The code I have put above, like that of the original user, which is also me, is for an external website, that needs to do the backend work of the app.

I need the user to get the questions they have asked. The code should send a REST API request to get those questions. But its not giving me the questions where SID = 6, it is giving me all of them.

The where clause is not working, its sending it, but the database returns all records, ignoring the WHERE clause ?