Question

I am attempting to connect to a DB on Cloudant. I created the DB from a JSON and uploaded it to Cloudant here: DeanRadar

I copied the info byte for byte into another JSON on my server including the "_id" and "_rev". If I call the JSON directly it works fine, but I can not get the code to work when I enter the URL given above.

I am guessing the URL is just a place holder and it gets resolved before returning it to my browser, like it is supposed to have a ".json" on the end of it or something that the browser can read but not the code. I do not know enough about Cloudant, Couch, angular, etc to know what I am looking for. I have done plenty of PHP/SQL databases but this is my first attempt with cloudant/jason/angular.

Here is the code in question (ignore the fact that I declare dbURL twice, it is there to show what I have used)

var dbURL = 'https://deanradar.cloudant.com/tempdata/80d7d28d9e96778ad3bf4531817ab190';
var dbURL = 'data/tempData.json';
                $http.get(dbURL).success(function(data) {
                    tempDataDeferred.resolve(data);
                });

This works, when I access the JSON on my server copied from the cloudant DB, but swapping the dbURL lines (accessing the direct URL for the cloudant DB) returns nothing. You can take that same URL and slap it into your browser address bar and see the info exactly as it sits in the JSON.

Grabbing the "[API URL+]" address doesn't help, it won't even resolve in the browser. Any idea what I need to do to access the DB?

Was it helpful?

Solution

Check this document

https://cloudant.com/for-developers/crud/#browser-update

although in examples they are using jquery.couch you can check the original code and apply it to your angularjs app

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top