This is a migrated thread and some comments may be shown as answers.

Backend (Everlive) login and query problems

3 Answers 397 Views
JavaScript SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AlexFStop
Top achievements
Rank 1
AlexFStop asked on 18 Feb 2014, 04:56 PM
I'm a first time Telerik App Builder and Everlive user. I created an Everlive Content Type and defined some fields and created 7 records. Next I tried to login and query but I got an error both times. The code is below (with the API key, login and password changed). I based it on my understanding of some of the examples in the documentation.
For the login attempt I got a "Invalid API key - code 607". For the query I got a "Not found - code 600".
I have a feeling that I am just not connecting to the Content Type (named "JOAD_ImagesDB") properly (although the debugger shows the return value as non-NULL), so the login failed (though I used the name and password of the only user defined for JOAD_ImagesDB) and then no data was retrieved by the query.
Obviously I am doing something wrong, but after hours of struggling I can't figure out what. Can anyone suggest something?
BTW, I am not using Kendo because the app is a very simple one and I don't need the Kendo capabilities.
Thanks in advance for any help anyone may offer.
--Alex

var el = new Everlive({
        apiKey: '123456', 
        url: '//api.everlive.com/v1',
        scheme: 'http'
}); 
Everlive.$.Users.login('abc', // username
      'def') // password
    .then(function (data) { // success callback, this returns the token that we can store to avoid re-authenticating this user!
        alert(JSON.stringify(data));
    },
    function(error) { // error callback
        alert(JSON.stringify(error));
    });

var JOAD_data = el.data("JOAD_ImagesDB");
var query = new Everlive.Query();
query.where().lt("Image_Date",LastDate).done().select("Image","Image_Description","Copyright_Owner").take(7);    
JOAD_data.get(query) // filter
    .then(function(data){
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });


3 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 18 Feb 2014, 05:22 PM
Hello Alex,

Thank you for contacting us!

Could you please try with the following initialization of the 'Everlive' object:
var el = new Everlive({
    apiKey: 'api-key',
    url: '//api.everlive.com/v1/',
    scheme: 'https'
});

Please note, the forward slash at the end of the url (this parameter could not be set explicitly).
Also, you can set the scheme to 'https'.

Please, let us know if this works for you.

Regards,
Anton Dobrev
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
AlexFStop
Top achievements
Rank 1
answered on 18 Feb 2014, 05:53 PM
Worked like a charm. Thanks a million.
0
Anton Dobrev
Telerik team
answered on 19 Feb 2014, 11:58 AM
Hello Alex,

We are glad that this solved the issue.

In general, it would be better to omit the 'url' parameter when initializing the 'Everlive' object, as it is already set by default in the SDK.

Regards,
Anton Dobrev
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Tags
JavaScript SDK
Asked by
AlexFStop
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
AlexFStop
Top achievements
Rank 1
Share this question
or