request: Execute an MTurk API Request

Description Usage Arguments Details Value Author(s) References

Description

This is the workhorse function that makes authenticated HTTP requests to the MTurk API. It is not exported as of v0.5.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
request(operation, GETparameters = NULL,
        keypair = c(Sys.getenv("AWS_ACCESS_KEY_ID"), 
                    Sys.getenv("AWS_SECRET_ACCESS_KEY")),
        browser = getOption('MTurkR.browser', FALSE),
        log.requests = getOption('MTurkR.log', TRUE),
        sandbox = getOption('MTurkR.sandbox', FALSE), 
        verbose = getOption('MTurkR.verbose', TRUE),
        validation.test = getOption('MTurkR.test', FALSE),
        service = "AWSMechanicalTurkRequester",
        version = NULL)

Arguments

operation

The MTurk API operation to be performed.

GETparameters

An optional character string containing URL query parameters that specify options for the request.

keypair

A two-element character vector containing an AWS Access Key ID and an AWS Secret Access Key. The easiest way to do this is to specify AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables using Sys.setenv() or by placing these values in an .Renviron file.

browser

Optionally open the request in the default web browser, rather than opening in R. Default is FALSE.

log.requests

A logical specifying whether API requests should be logged. Default is TRUE. See readlogfile for details. The log is stored, by default, in the working directory at the time MTurkR is loaded. This can be changed using options("MTurkR.logdir"); if not set, the current working directory is used.

sandbox

Optionally execute the request in the MTurk sandbox rather than the live server. Default is FALSE.

verbose

Whether errors produced by the MTurk API request should be printed.

validation.test

Currently a logical that causes request to return the URL of the specified REST request. Default is FALSE. May additionally validate the request (and supply information about that validation) in the future.

service

The MTurk service to which the authenticated request will be sent. Supplied only for advanced users.

version

The version of the MTurk API to use.

Details

This is an internal function that executes MTurk API requests. It is made available for use by advanced users to execute custom API requests.

Value

A list of class “MTurkResponse” containing:

operation

A character string identifying the MTurk API operation performed.

request.id

The Request ID created by the API request.

request.url

The URL of the MTurk API REST request.

valid

A logical indicating whether or not the request was valid and thus executed as intended.

xml

A character string containing the XML API response.

Author(s)

Thomas J. Leeper

References

API Reference


cloudyr/MTurkR documentation built on June 4, 2019, 3:30 p.m.