Page 1 of 1

Access Appery Database from a website using Jquery

Posted: Mon Jan 27, 2014 9:31 pm
by Bad Addy

I have had the answer to this, and now I am unable to find it!!

I need working example, of how I pull information from a appery database, via an external website. Most of the work is on the app. But some backend stuff needs a website. I have done this, but i am unable to find any information, or the code I used the last time.

Using jquery, PUT and GET, what examples are there ?


Access Appery Database from a website using Jquery

Posted: Mon Jan 27, 2014 9:41 pm
by Alena Prykhodko

Hello,

This post should help https://getsatisfaction.com/apperyio/...


Access Appery Database from a website using Jquery

Posted: Mon Jan 27, 2014 10:21 pm
by Bad Addy

Thank you, that does help, and infact, that is me. But I have no idea how, or why, I have two accounts on here ?

Is there another with examples, like the above. I tried to search my name, but nothing came up ?


Access Appery Database from a website using Jquery

Posted: Mon Jan 27, 2014 11:51 pm
by Alena Prykhodko

Appery.io databases, push and server code scripts can be easily accessed from any outside system via REST APIs. The documentation provides curl commands for each operation. A curl command is a universal language for explaining REST requests and can be used in any programming language.

Defining requests outside of Appery.io service editor is outside the scope of our support.


Access Appery Database from a website using Jquery

Posted: Tue Jan 28, 2014 2:52 pm
by Bad Addy

I am trying to POST to the database, but i keep getting an error,and I have looked at the docs, but still am unable to understand what the error is:

POST https://api.appery.io/rest/1/db/colle... 400 (Bad Request)

This is the code:

Code: Select all

 
 $.ajax({ 
   type: 'POST', 
   beforeSend: function(request) {  
request.setRequestHeader('X-Appery-Database-Id', '52*********');
}, url: '[url=https://api.appery.io/rest/1/db/collections/questions]https://api.appery.io/rest/1/db/colle...[/url]', data: {"question":"name2"}, dataType: "json", contentType:'JSON', success: function(response) { console.log("Successfully loaded"); }, error: function(xhr, ajaxOptions, thrownError) { console.log("Load error: " + xhr.status + " " + xhr.responseText); } });
[code] Here I am trying to post 'name2' into a col called question within a custom collection called questions ?

Access Appery Database from a website using Jquery

Posted: Tue Jan 28, 2014 4:26 pm
by maxkatz

Are you able to to get a GET request working?


Access Appery Database from a website using Jquery

Posted: Tue Jan 28, 2014 5:07 pm
by Bad Addy

yes, thank you :)