dw_test_key: Tests the Datawrapper-API-key

View source: R/dw_test_key.R

dw_test_keyR Documentation

Tests the Datawrapper-API-key

Description

Tests the key by querying the Datawrapper-API for user information.

Usage

dw_test_key(api_key = "environment")

Arguments

api_key

Required. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by datawrapper_auth.

Value

A S3-structure of type dw_user with the elements from the Datawrapper-API, and the following fields:

status

Returns 'ok' if the API-key used was correct.

data$user$id

Returns the internal user id.

data$user$email

The users e-mail adress.

data$user$isAdmin

Specifies, if the current user is admin in his/her organization.

data$user$organization$id

Returns the organization's id or short name.

data$user$organization$name

Returns the organization's full name.

Note

This function tests the API key by retrieving information about the current user from the API. If this works, the API-key is set correctly and ready to go.

Author(s)

Benedict Witzenberger

Examples


## Not run: dw_test_key() # uses the preset key in the .Renviron-file

## Not run: dw_test_key(api_key = "1234ABCD") # uses the specified key


munichrocker/DatawRappr documentation built on March 20, 2024, 6:08 a.m.