'PUT /api/requests/{encoded_request_id}
Updates a request state, sample state or sample dataset transfer status
depending on the update_type'

@web.expose_api
def update(self, trans, id, key, payload, **kwd):

    update_type = None
    if ('update_type' not in payload):
        trans.response.status = 400
        return "Missing    required    'update_type'    parameter.        Please    consult    the    API    documentation    for    help."
    else:
        update_type = payload.pop('update_type')
    if (update_type not in self._update_type_values):
        trans.response.status = 400
        return ("Invalid    value    for    'update_type'    parameter    (    %s    )    specified.        Please    consult    the    API    documentation    for    help." % update_type)
    try:
        request_id = trans.security.decode_id(id)
    except TypeError:
        trans.response.status = 400
        return ('Malformed        request    id    (    %s    )    specified,    unable    to    decode.' % str(id))
    try:
        request = trans.sa_session.query(trans.app.model.Request).get(request_id)
    except:
        request = None
    if ((not request) or (not (trans.user_is_admin() or (request.user.id == trans.user.id)))):
        trans.response.status = 400
        return ('Invalid    request    id    (    %s    )    specified.' % str(request_id))
    if (update_type == 'request_state'):
        return self.__update_request_state(trans, encoded_request_id=id)
