Dan
Dan

Reputation: 163

How do you specify the requester's workerID in a mechanical turk HIT?

I want to create an mturk HIT that has a URL like so:
www.example.com?source=worker_id
where worker_id is the worker's ID code. I'm initially going to create these from the mturk web UI, then once I get it working right, from PHP. But I can't figure out how to get at the worker's ID from the modified-HTML syntax of an mturk HIT.

Upvotes: 7

Views: 3582

Answers (2)

Tac Tacelosky
Tac Tacelosky

Reputation: 3426

Note that the workerId is NOT sent during the preview, only after the HIT has been accepted. If you're using an External HIT, you can create a cookie to see if it's a worker who has accepted a previous hit, but of course that method is unreliable.

Upvotes: 2

Nate
Nate

Reputation: 3038

Mechanical Turk will call your website with a URL that looks like:

www.example.com/?hitId=2384239&assignmentId=ASD98ASDFADJKH&workerId=ASDFASD8

In your php page that is at that location you can access the workerId (as well as the other Ids) like so:

<?php
$hitId        = $_REQUEST["hitId"];
$assignmentId = $_REQUEST["assignmentId"];
$workerId     = $_REQUEST["workerId"];

echo "Hit ID: $hitId\n";
echo "Ass ID: $assignmentId\n";
echo "Worker ID: $workerId\n";
?>

Upvotes: 11

Related Questions