library(prolific.api)
# Create API access
prolific_api_access <- api_access(api_token = "")
# View fields
## RefClass Methods
prolific_api_access$accessors
prolific_api_access$api_token
prolific_api_access$entrypoint
## S4 Methods
accessors(prolific_api_access)
api_token(prolific_api_access)
entrypoint(prolific_api_access)
# Change fields
# (this is usually only required for the api_token)
# replace in the by the actual API token
# before running these lines
if (FALSE) {
## RefClass Method
prolific_api_access$api_token <- ""
## S4 Method
api_token(prolific_api_access) <- ""
}
# Note: For the following code to work,
# you have to replace in the lines above by the actual API token
if (FALSE) {
# Check wheter Authorization is working
## RefClass Method
prolific_api_access$check_authorization()
## S4 Method
check_authorization(prolific_api_access)
# Obtain list of existing studies
## RefClass Method
list_of_studies <-
prolific_api_access$access(
endpoint = "studies",
method = "get",
as_list = TRUE
)
## S4 Method
list_of_studies2 <-
access(
prolific_api_access,
endpoint = "studies",
method = "get",
as_list = TRUE
)
}
Run the code above in your browser using DataLab