I have gone through the documentation multiple times and am feeling a little helpless. I don't quite understand how Kinvey stores data. In my Files collection in the web console, I have uploaded a JSON file containing a few entries. I would like to retrieve the entries from my Backbone client. This is the syntax I am using:
var MyModel = Kinvey.Backbone.Collection.extend({url : 'Files'});
var model = new MyModel();
model.fetch({
dataType: 'jsonp',
success: function(){
console.log('Data is loading');
}
This returns an empty object instead of the applicants JSON file I have uploaded. The documentation asks to request in the format : /appdata/:appKey/Files but this throws a 404 error. I have a feeling that I am completely off track. Can someone please explain how the data stored in a collection can be retrieved on the Backbone client. Also, what if I want to make each data item specific to different users. I am a complete beginner and would really appreciate your patience. Thank you
1 Comment
Damien Bell
said
almost 6 years ago
Good morning @Shardenu_g,
It looks a little bit like you're looking at 2 different sources of information here. The /appdata/appkey/files route to your data is typically how it is consumed via REST api queries from within your app or directly from within the console itself.
Did you take a look at the guide for datastores within backbone? The section specifically for fetching a file is here: http://devcenter.kinvey.com/backbone/guides/datastore#Fetching .
Please let me know if this doesn't resolve your issue,
shardendu_g
I am using Backbone.js with Kinvey.
I have gone through the documentation multiple times and am feeling a little helpless. I don't quite understand how Kinvey stores data. In my Files collection in the web console, I have uploaded a JSON file containing a few entries. I would like to retrieve the entries from my Backbone client. This is the syntax I am using:
var MyModel = Kinvey.Backbone.Collection.extend({url : 'Files'});
var model = new MyModel();
model.fetch({
dataType: 'jsonp',
success: function(){
console.log('Data is loading');
}
This returns an empty object instead of the applicants JSON file I have uploaded. The documentation asks to request in the format : /appdata/:appKey/Files but this throws a 404 error. I have a feeling that I am completely off track. Can someone please explain how the data stored in a collection can be retrieved on the Backbone client. Also, what if I want to make each data item specific to different users. I am a complete beginner and would really appreciate your patience. Thank you