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

Access Database Outside Appery

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 ?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Access Database Outside Appery

Sorry, my mistake - 51d56645e4b0b3e9055d450c is object _id.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Access Database Outside Appery

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.

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

Access Database Outside Appery

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Access Database Outside Appery

It was automatically created in DB.

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

Access Database Outside Appery

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Access Database Outside Appery

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.

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

Access Database Outside Appery

Thank you :)

Tolga Gunduz
Posts: 0
Joined: Wed Sep 10, 2014 3:26 pm

Access Database Outside Appery

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

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

Access Database Outside Appery

Hi Tolga,

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

Return to “Issues”