Page 2 of 4

Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:23 am
by Andrew Walker

I have the code that works, and brings a collection from the database, but I am still unable to understand how you create an object_id. It's in code, so where I I get this code from?

You keep pointing me to the docs for databases, but still that only talks about the app builder and cURL commandline requests.

If I create a service, such as a read service, where do I find this code for that service, but I am unable find anything that could resemble it ?


Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:23 am
by Maryna Brodina

Sorry, my mistake - 51d56645e4b0b3e9055d450c is object _id.


Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:39 am
by Maryna Brodina

When a new object is created, the following three columns are automatically created: _createdAt, _updatedAt, and _id. These field names are reserved, so you cannot set them yourself.
You can send for example List request to recieve all objects or Query request with "where" parameter to get some specific object and use them (these objects _id) the way you need.


Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:43 am
by Andrew Walker

Right, where did that number come from, where and how was it created ?


Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:51 am
by Maryna Brodina

It was automatically created in DB.


Access Database Outside Appery

Posted: Fri Dec 06, 2013 11:51 am
by Andrew Walker

Right, so an object is a record _id, which you can update, read etc....

If I want to query a collection, I use the WHERE clause in the url. There are no examples of how this would look like:

[url: "https://api.appery.io/rest/1/db/colle...]

Is this how it should look ?

Thank you for your help, and sorry if i am being a little dumb, I just cannot see this in any documentation.


Access Database Outside Appery

Posted: Fri Dec 06, 2013 12:01 pm
by Maryna Brodina

Correct URL will look like this prehttps://api.appery.io/rest/1/db/collections/collectionName?where_id={"_id": "23894892342"}/preNote: parameters should be url encoded. To do that use encodeURIComponent JS function.


Access Database Outside Appery

Posted: Fri Dec 06, 2013 12:02 pm
by Andrew Walker

Thank you :)


Access Database Outside Appery

Posted: Mon Sep 15, 2014 8:11 am
by Tolga Gunduz

Hi,

I am trying to access our database from external website. I can access from jsfiddle.com when I try the script there but I cannot access from our website.

What could be the reason?

Thanks


Access Database Outside Appery

Posted: Mon Sep 15, 2014 10:09 am
by Kateryna Grynko

Hi Tolga,

Could you please show how you do it?
Do you use the same code?
Did you check the console?