(In the past year, AWS updated the MTURK API, obsoleting the old API. As a result old SO threads on this topic are out of date.)
I have the MTURK SDK working to post live HITS. Now I'm trying to use the SDK to call the MTURK sandbox. The MTURK docs don't seem to document how to do this, and while I have been stepping through the code (e.g. public static function _apply_endpoint_provider
) I haven't yet found the correct approach.
In the new MTURK SDK, what is the correct way to specify a sandbox endpoint?
Update:
The MTURK SDK seems to set the endpoint for me. It never asks me to set it and seems to build it itself. In partitionendpointprovider.php
, I can see it is loading the sandbox endpoint to:
$data["partitions"][0]["services"]["mturk-requester"]["endpoints"]["sandbox"]["hostname"]
...but I don't yet see any way to tell the SDK to use that endpoint.
What is the correct way to tell the SDK that I'd like to use the sandbox endpoint?
Found it -- https://blog.mturk.com/tutorial-using-the-mturk-api-with-the-aws-sdk-for-php-472dc70dc4c3
$mTurk = new Aws\MTurk\MTurkClient([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
]);
Use your own server's regions, of course.