I’m trying to set up Rturk to outsource some work to Amazon’s Mechanical Turk. When I try to create my HITs, I keep running into t he following error in console:
RestClient::BadRequest: 400 Bad Request
When I copy the URL and paste it in my browser to get the response, I get the following message:
This user is not authorized to perform the requested operation
Do you guys have any idea what could be happening here? I am following the rturk documentation on github. https://github.com/mdp/rturk Is it possible that the gem has to be updated?
RTurk.setup(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY_ID'], :sandbox => true)
hit = RTurk::Hit.create(
:title => "Sample turk",
:assignments_duration => 1.hour,
:expires_at => 1.day.from_now
) do |hit|
hit.lifetime = 1.day
hit.assignments = 1
hit.description = "Test description."
hit.keywords = "places, search, map, location"
hit.question(mturk-fb_path, :frame_height => 750)
hit.reward = reward
if approval_rate
hit.qualifications.add :approval_rate, { :gt => approval_rate }
end if abandoned_rate
hit.qualifications.add :abandoned_rate, { :lt => abandoned_rate }
end
if is_us
hit.qualifications.add :country, { :eql => "US" }
end
end
}
A couple things might be going on here:
:assignments_durationand:expires_atare valid options. You should be usinghit.durationto specify the amount of time a worker has to complete a hit once they accept it andhit.lifetimeto set the amount of time until the hit will expire.mturk-fb_pathis not a valid ruby variable name. (can’t use a dash)Try starting off with the simplest example that you can build off of once you get it working. This example from rturk should be a good start: https://github.com/mdp/rturk#creating-hits.
Also, I definitely recommend reading through the mturk docs for creating a hit: http://docs.aws.amazon.com/AWSMechTurk/2011-10-01/AWSMturkAPI/ApiReference_CreateHITOperation.html.