Reputation: 1418
I am trying to replicate the following apigee oauth call in windows 7 in R. I have tried Roauth, (python) oauth-proxy with RCurl (probably the best way, but I cannot figure it out), and others. Here is the apigee call that works fine:
GET /places/geocode?geo=%7B%22%24point%22%3A%5B34.06021%2C-118.41828%5D%7D HTTP/1.1
Authorization:
OAuth oauth_consumer_key="myKey",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1372529150",
oauth_nonce="1274556232",
oauth_version="1.0",
oauth_signature="someSignature"
Host: api.v3.factual.com
X-Target-URI: http://api.v3.factual.com
Connection: Keep-Alive
My needs are for an oauth connection that stays open so that I can call the API in R. Any help would be really appreciated, specifically with how the above fields read into the solutions. Thank you in advance for your time.
Upvotes: 2
Views: 322
Reputation: 43
Apologies that I'm not getting your exact request to work, that method is now deprecated (http://developer.factual.com/api-docs/#Geocode). The good news is that connecting to the new geotag API call looks much easier and doesn't require the OAuth back-and-forth (http://developer.factual.com/api-docs-v4/#Geotag). Here's what your Apigee request would look like in V4:
require(httr)
## Factual credentials
consumerKey <- "" ## your API key from Factual
## geotag demo - V4 API
geotag <- GET(paste0('https://api.factual.com/geotag?latitude=34.06021&longitude=-118.41828&KEY=',consumerKey))
content(geotag)
I'm assuming, though, that connecting to the other endpoints for Factual is still an interesting question. Just this morning I got this to work based on the answer to Using the Yelp API with R, attempting to search business types using geo-coordinates.
I'm just showing the place categories here but have used this signature to connect to the read places as well.
require(httr)
## Factual credentials
consumerKey <- "" # your key
consumerSecret <- "" # your secret
## authorization
myapp <- oauth_app("Factual", key=consumerKey, secret=consumerSecret)
## R will ask to cache credentials between these lines
sig <- sign_oauth1.0(myapp)
data <- GET('https://api.v3.factual.com/t/place-categories?limit=500',
sig)
content(data)
Upvotes: 1