0

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?

1
  • I already tried using "username:[email protected]", but it didn't work, which is why I think I need to add an extension or something to the end of the URL. Commented Mar 17, 2014 at 11:21

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

I read through that and didn't really see what I am doing different. They included the "_rev" but that shouldn't really matter would it? You can just access it through 'deanradar.cloudant.com/tempdata/…' and it shows exactly what I need, in the browser anyway. Maybe you are trying to suggest using a totally different approach? I think I missed something.
That link to cloudant requires authentication from me, did you tried to debug your call from angularjs in i.e chrome developer tools to see what error you getting??
oh my F-BOMB! I didn't even think about that!! I kept looking in the same browser that I was already logged into cloudant with. OK, this at least gives me a different perspective on things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.