I am trying to use the Rlinkedin package to establish a connection to Linkedin.
I have followed the instructions in Rlinkedin package and r-bloggers link.
My code snippet looks like this (keys are hidden while posting):
library(Rlinkedin)
app_name <- "XXXX"
consumer_key <- "XXXX"
consumer_secret <- "XXXX"
in.auth <- inOAuth(app_name, consumer_key, consumer_secret)
my.connections <- getMyConnections(in.auth)
I have authenticated it through a browser, and my linkedin application page shows connections in the statistics.
However I get an error message as follows:
Error in UseMethod("xpathApply") :
no applicable method for 'xpathApply' applied to an object of class "c('xml_document', 'xml_node')"
Additionally running:
getCompany(token=in.auth, universal_name="Facebook")
Results in error:
Error in if (!is.na(q.content[["number(//error/status)"]] == 404)) { :
argument is of length zero
I tried using the package from github as well, but the same issue occurs.
They changed the rules about the API last May. You have to have a full partnership arraignment through your company to use the functions in that package.
I ran this package with elevated but non-partner privileges after contacting LinkedIn's developer program last year and even then the amount of stuff you could query was trivial and limited to your own profile.
On May 12th 2015 LinkedIn changed the availability for most of their
API endpoints. In order to gain full access to the API, you must apply
to their Partnership Program. You can find detailed information
regarding what endpoints are still openly available in their
Transition Guide.
Regarding this R package, the following lists cover which functions
are and are not available for non-partners. If I gain access to their
partnership program I will update the package accordingly.
As you can see from the quote above (taken from the package's GitHub page), even the package's author doesn't have partner access.
Related
I've verified my API in RStudio after hours of trying and now I've reached another error while trying to translate a sentence. Would be grateful for any help!
I'm just trying to translate "hello" to french using googleLanguageR package -
> gl_translate("Hello", "fr")
The result I get is this -
2021-01-21 17:15:36 -- Translating text: 5 characters -
i 2021-01-21 17:15:36 > Request Status Code: 403
Error: API returned: Request had insufficient authentication scopes.
I'm a literal beginner in the field of computing and do not understand what scopes mean here.
Thanks for the help!
Scopes are permissions that you give to apps you use to access an API. For example, one App might have permission to read the private messages of a users, whereas another doesn't. It's similar to when an app on your phone asks for permission to use the camera, or access your contacts.
Your app is trying to do something that it doesn't have permission to do. You'll need to add the relevant scopes in whatever setting that it is where you're generating keys etc. Presumably Google Data Studio?
Okay, I found an answer.
I needed to download a json version of my key and authorize it using the code -
gl_auth("filename.json")
After doing this, I needed to make sure my API is enabled. Now, it is working perfectly!
I'm trying to get data from my GA account using R. I've managed to do this with RGoogleAnalytics package. Unfortunetally I have a problem with authentication on production server. Everything works but I have to refresh token each day (and it is not acceptable for me). I've read about need of refresh_token but I have no idea how to obtain it using this package... What I did is:
library("RGoogleAnalytics")
client.id <- "XXX"
client.secret <- "XXX"
token <- Auth(client.id, client.secret)
save(token, file = "./auth/token")
load("./auth/token")
ValidateToken(token)
It works only for few hours (when token is valid) and the next day I get the error: Error: Refresh token not available. How to get this refresh token? Auth function does not seem to give it to me and after reading whole Internet I still have no idea how to deal with it. Could you help?
the RGoogleAnalytics package gives an easy way to extract the Google Analytics Data. but I think you should consider other packages that are more up to date and that are a little bit 'easier' to deal with(like the googleAnalyticsR package)
In my experience, practically all google services need this 'authentication' when using the API, and generally, the token expires, however, it is possible to generate a 'permanent token'.
This form for this 'permanent token' is a little 'hard', but once learned, you will be able to apply it in a similar way to most of Google's API services!
In summary, you need to create a project there in the GCP (Google Cloud console) to create an authentication key :
I recommend reading this first:
https://cloud.google.com/docs/authentication
In the documentation link below, you can find a step by step for this authentication for the RgoogleAnalytics package.
https://cran.r-project.org/web/packages/RGoogleAnalytics/RGoogleAnalytics.pdf
I am using RAdwords package to export the data from Google Adwords. Below is the code I am running and the error I am getting.
body <- statement(select=c('Clicks','AveragePosition','Cost','Ctr'),
report="ACCOUNT_PERFORMANCE_REPORT",
start="20150101",
end="20151231")
data <- getData(clientCustomerId="XXX-XXX-XXXX",
google_auth=google_auth,
statement=body)
Error in if (data[nrow(data), 1] == "Total") { :
argument is of length zero
It seems like maybe you're having an issue that's not tracked well by the error that's thrown. I had a similar issue and it turned out that I didn't have the correct level of access needed with my developer token. You may need to work with your team to get access to a developer token with at least basic access in order to access client information through your MCC using RAdwords. Test account access is not enough to access client data.
I try to use RGoogleDocs and get
Error: Forbidden
I have two-step verification on: is there a work-around?
sheets.con = getGoogleDocsConnection(getGoogleAuth(user, ps, service = "wise"))
Error: Forbidden
Relevant question
The getGoogleAuth of RGoogleDocs package is based on an officially deprecated ClientLogin to connect google server, see https://developers.google.com/identity/protocols/AuthForInstalledApps?csw=1
You may use the application password of google as a try.
Another way is just use the url of you google docs to visit certain contents, see http://www.r-bloggers.com/access-google-spreadsheet-directly-in-bash-and-in-r/
Update:
In the source code of getGoogleAuth, the author used an application called 'R-GoogleDocs-0.1', you may apply an new application and get the token. Then I think you could use the token and the api from google to access google docs directly in R. However, such hacks almost mean update/rewrite RGoogleDocs package.
I am starting with twitteR . I followed the official guide and I did not receive any error during the configuration.
(the official guide http://cran.r-project.org/web/packages/twitteR/vignettes/twitteR.pdf)
When I try to run the first example I receive an error.
> cred$handshakeComplete
[1] TRUE
> cranTweets <- userTimeline('cranatic')
Error in twInterfaceObj$doAPICall(cmd, params, method, ...) :
OAuth authentication is required with Twitter's API v1.1
Probably I am making something wrong.
Can anyone help me?
SOLUTION!!!
the problem was that instead of repeat all the procedure I loaded the RData saved the first time.
So I think that every times we need to repeat all the procedure described in
http://cran.r-project.org/web/packages/twitteR/vignettes/twitteR.pdf
In the very first lines the official guide you mention
This package is intended to be combined with the ROAuth package as as of
March 2013 the Twitter API requires the use of OAuth authentication.
It's not an error. You need to provide the relative credential.