ropensci / sofa

Easy R interface to CouchDB
https://docs.ropensci.org/sofa/
33 stars 17 forks source link

Not able to connect to Cloudant with an API-Key #35

Closed patperu closed 8 years ago

patperu commented 8 years ago

Hello Scott,

I always use my username and password to connect to a Cloudant Database. Now I would like to give someone else read/write access to a selected DB. So I generated an API Key/Secret for this DB and tried to connect with this combination. But I got an error, see script:

library('sofa')

# with my username and password - it works!
user_name <- "fake"
user_pwd  <- "notreal"

cushion('cloudant', user = user_name, pwd= user_pwd, type="cloudant")
ping('cloudant')
# $couchdb
# [1] "Welcome"
# $version
# [1] "1.0.2"
# $cloudant_build
# [1] "2530"

# With the API-Key (fictional) for the Sample-DB 'ariaarpa' I got this error message:
api_name <- "rofetog"
api_pwd  <- "a638ce138ec"

cushion('api_cloudant', user=api_name, pwd=api_pwd, type="cloudant")
ping('api_cloudant')
# Error: lexical error: invalid char in json text.
#                                       <html><body><h1>503 Service Una
#                     (right here) ------^ 

Thanks for any help! Patrick

sckott commented 8 years ago

@patperu what version of sofa do you have, latest?

sckott commented 8 years ago

In my testing with the latest version, this should work fine. It looks like in the error message there is a 503 error, meaning the service is unavailable. Are you sure those are the correct credentials?

And you said key and username/pwd. Is the 2nd set of credentials not a username/pwd? If an API key that probably won't work as the user/pwd params put those credentials in a specific place in the request

sckott commented 8 years ago

@patperu did you see my comment above? any thoughts?

patperu commented 8 years ago

Hello @sckott yes, thank you! I have send you an email on 12/02/2015 with more details. And I think I have to learn a little bit more about APIs... So for the moment we could close this issue.

sckott commented 8 years ago

okay, i'll look at that email and get back to you here if need be