approveAssignment method

Future<void> approveAssignment({
  1. required String assignmentId,
  2. bool? overrideRejection,
  3. String? requesterFeedback,
})

The ApproveAssignment operation approves the results of a completed assignment.

Approving an assignment initiates two payments from the Requester's Amazon.com account

  • The Worker who submitted the results is paid the reward specified in the HIT.
  • Amazon Mechanical Turk fees are debited.
If the Requester's account does not have adequate funds for these payments, the call to ApproveAssignment returns an exception, and the approval is not processed. You can include an optional feedback message with the approval, which the Worker can see in the Status section of the web site.

You can also call this operation for assignments that were previous rejected and approve them by explicitly overriding the previous rejection. This only works on rejected assignments that were submitted within the previous 30 days and only if the assignment's related HIT has not been deleted.

May throw ServiceFault. May throw RequestError.

Parameter assignmentId : The ID of the assignment. The assignment must correspond to a HIT created by the Requester.

Parameter overrideRejection : A flag indicating that an assignment should be approved even if it was previously rejected. Defaults to False.

Parameter requesterFeedback : A message for the Worker, which the Worker can see in the Status section of the web site.

Implementation

Future<void> approveAssignment({
  required String assignmentId,
  bool? overrideRejection,
  String? requesterFeedback,
}) async {
  ArgumentError.checkNotNull(assignmentId, 'assignmentId');
  _s.validateStringLength(
    'assignmentId',
    assignmentId,
    1,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'MTurkRequesterServiceV20170117.ApproveAssignment'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AssignmentId': assignmentId,
      if (overrideRejection != null) 'OverrideRejection': overrideRejection,
      if (requesterFeedback != null) 'RequesterFeedback': requesterFeedback,
    },
  );
}