Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Using ?WHERE= in URL database call

Please try next code:
pre
$.ajax({
type: "GET",
beforeSend: function(request) {
request.setRequestHeader("X-Appery-Database-Id", "5166b6a8e4b055aafd1f2167");
},
url: "https://api.appery.io/rest/1/db/collections/todo",
data: {
where: JSON.stringify({Name:"name2"})
},
dataType: "json",
success: function(response) {
console.log("Successfully loaded");
},
error: function(xhr, ajaxOptions, thrownError) {
console.log("Load error: " + xhr.status + " " + xhr.responseText);
}
});
/pre

Andrew Walker
Posts: 0
Joined: Thu Dec 05, 2013 9:11 am

Using ?WHERE= in URL database call

This works great as manual, but if "name2" was a variable, it does not show the var value, just another error?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Using ?WHERE= in URL database call

Name - it's a Db collection filed name, "name2" - field value. If you use variable in where cause it should be enclosed in single quotes. Something like this:
"'variableName'"

Andrew Walker
Posts: 0
Joined: Thu Dec 05, 2013 9:11 am

Using ?WHERE= in URL database call

Thank you, works a treat :)

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Using ?WHERE= in URL database call

Hello, I have some code, and its not working. The Where clause, as above, does not come back with anything. But it will bring back all records without the data: part in.

code
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: {
where: JSON.stringify({sid:sid})
},
/code

Any ideas ?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Using ?WHERE= in URL database call

I cannot seem to fix this. Really need a hand. It seems to work based on the comments, but now its not working, if i copy exactly the same!!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using ?WHERE= in URL database call

Hi,

Please share the app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and tell us where to see this

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Using ?WHERE= in URL database call

This is using REST API not in appery. sid is a number, and is given a number in the database, rather than string. Would that make a difference. ?

I have added support.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using ?WHERE= in URL database call

What is the app name?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Using ?WHERE= in URL database call

urVoice

Return to “Issues”