Amazon Mechanical Turk
API Reference (API Version 2012-03-25)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

HITLayout

Description

A HITLayout is a reusable template used to provide Human Intelligence Task (HIT) question data for CreateHIT. A HITLayout template is created a by creating a Mechanical Turk project on the Requester website. For more information about creating a project, see How to Create a Project in the Requester UI Guide.

Each HITLayout template can contain parameter placeholders with the format ${parameter_name}. A HITLayoutId identifies the HITLayout created in the Requester UI, which can be used to call CreateHIT multiple times, with different parameter values supplied each time for the placeholders. Each CreateHIT call merges the parameter values into the HITLayout template to generate the HIT question document. The parameter values are defined by the HITLayoutParameter data structure. For more information, see HITLayoutParameter.

Requesters can use this substitution capability to create a large number of HITs that all share a common design. For example, you could create a HIT question that asks Workers to provide keywords for an image and draw boxes around key image features using a JavaScript library. First, you use the Requester UI to create a Mechanical Turk project that uses a parameter placeholder for the image URL. Then you call CreateHIT with the same HITLayout iteratively, using a different image URL value each time. Each call to CreateHIT uses the same HITLayoutId, but each call uses a different HITLayoutParameter structure containing a unique image URL.

Obtaining a Layout ID

A Layout ID is assigned to each Mechanical Turk project you create on the Requester website. You use this Layout ID value as the value for the HITLayoutId when calling CreateHIT. The Layout ID you pass as the HITLayoutId parameter to CreateHIT identifies the project template used for the HIT you create. Mechanical Turk projects can contain parameter placeholders in the format ${parameter_name}. The parameter names that you pass to CreateHIT must match the parameter names used in the project template created in the Requester UI. You view the Layout ID and the list of parameters used in your template by clicking on the Project Name of an existing project on the Create tab New Batch with an Existing Project page, which is located at https://requester.mturk.com/create/projects, or the Sandbox page located at https://requestersandbox.mturk.com/create/projects.

Click on an existing project's name to view the Layout ID and Parameters used in your project template.

Click Project Name to View LayoutID

Since the Requester UI creates HTMLQuestion HITs, the HITLayout that the UI creates also creates HTMLQuestion documents. HITLayoutParameter values with reserved characters or invalid HTML markup may result in an invalid HTMLQuestion document. For more information, see HTMLQuestion.

Using a HITLayout

You can use the HITLayout form of HIT by calling CreateHIT with a HITLayoutId and a list of HITLayoutParameter structures. You need one structure for each of the values you want substituted. The parameter substitution is done when you call CreateHIT to create a HIT. The parameter values cannot be changed after the HIT has been created.

Note

You can use either the HITLayoutId or the Question parameter when calling CreateHIT, but not both.

Guidelines for Using HITLayouts

  • Once created, the HIT behaves like an HTMLQuestion HIT, which gives you the option to use HTML and JavaScript features in your HIT design, including Asynchronous JavaScript and XML (AJAX) callbacks.

  • Parameter substitution allows you to replace a short parameter name with long strings of text. You will receive errors if the resulting document is longer than permitted by the Question parameter of CreateHIT.

  • The HITLayout is used to create an HTMLQuestion document. HITLayoutParameter values with reserved characters or invalid HTML markup may result in an invalid HTMLQuestion document.