Description Usage Arguments Details Functions Author(s) Examples
Provides a means to authenticate yourself with the BrandsEye API. Most of the time you will want to do this using a BrandsEye API key.
1 2 3 4 5 | authentication(key = NULL, user = NULL, password = NULL)
authentication_filename()
authenticate(key = NULL, user = NULL, password = NULL, save = FALSE)
|
key |
Your API key. Contact your client service representative if you do not already have one. You do not need to have a username or password if you are using an API key. |
user |
Your username, if you know it. This should be used with your password. |
password |
To be used in conjunction with a username |
save |
Set this to true if your authentication details should be saved across sessions. |
This function allows you to set a global variable holding your authentication details. The various BrandsEyeR functions will use these authentication details when communicating with the BrandsEye API.
It's possible to set up default authentication information as well which will be loaded automatically every time you load the BrandsEyeR library.
In your home directory,
create the file $HOME/.brandseyerd/authentication.json
.
This file can contain either a key, or a user / password pair. For example, to specify your key, the file should contain:
{
"key": "12342342342354345"
}
To specify a username and password pair, the file should contain:
{
"user": "connie@brandseye.com",
"password": "This would be awkward if it were my real password"
}
You can use the authenticate
function to save a stub file
for you to edit in your home directory. On windows, this might be in your
My Documents
directory. You can use the authentication_filename
function to find the directory and file name to save the authentication file in.
You can also use the authenticate
file to create the file for
you in the appropriate place. Call it with no arguments to just make an empty file.
If you provide arguments, it will fill in the file for you, as needed.
Be wary of calling it with arguments, since your key or password will
land up in your R history file. The best practise is to call
authenticate
with only save = TRUE
and
no other arguments set and edit the file manually.
On a shared computer, set permissions on that file so that only your user
can read it. Your authentication details are saved in plain text.
authentication_filename
: Returns the file name in which you can save your authentication information.
authenticate
: Save your authentication for your current R session, or in a file for later R sessions.
Constance Neeser
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## Not run:
authentication("adfd42345f534fgdfgd")
authentication(key = "adfd42345f534fgdfgd")
# Authenticating with a username and password
authentication(user = "jo.blogs@brandseye.com",
password ="This is a safe password!!")
## End(Not run)
## Not run:
# Create a json stub to fill in your authentication details:
authenticate(save = TRUE)
# And this will be created at:
authentication_filename()
# Log in for the session
authenticate(key = "this is my api key")
# Use the API with those credentials
account_count("QUIR01BA", "published inthelast month")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.