'PUT /api/samples/{encoded_sample_id}
Updates a sample or objects related ( mapped ) to a sample.'

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

    update_type = None
    if ('update_type' not in payload):
        trans.response.status = 400
        return "Missing    required    'update_type'    parameter,    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,    consult    the    API    documentation    for    help." % update_type)
    sample_id = util.restore_text(id)
    try:
        decoded_sample_id = trans.security.decode_id(sample_id)
    except TypeError:
        trans.response.status = 400
        return ('Malformed    sample_id    (%s)    specified,    unable    to    decode.' % str(sample_id))
    try:
        sample = trans.sa_session.query(trans.app.model.Sample).get(decoded_sample_id)
    except:
        sample = None
    if (not sample):
        trans.response.status = 400
        return ('Invalid    sample    id    (    %s    )    specified.' % str(sample_id))
    if (not trans.user_is_admin()):
        trans.response.status = 403
        return 'You    are    not    authorized    to    update    samples.'
    requests_admin_controller = trans.webapp.controllers['requests_admin']
    if (update_type == 'run_details'):
        deferred_plugin = payload.pop('deferred_plugin', None)
        if deferred_plugin:
            try:
                trans.app.job_manager.deferred_job_queue.plugins[deferred_plugin].create_job(trans, sample=sample, **payload)
            except:
                log.exception(('update()    called    with    a    deferred    job    plugin    (%s)    but    creating    the    deferred    job    failed:' % deferred_plugin))
        (status, output) = requests_admin_controller.edit_template_info(trans, cntrller='api', item_type='sample', form_type=trans.model.FormDefinition.types.RUN_DETAILS_TEMPLATE, sample_id=sample_id, **payload)
        return (status, output)
    elif (update_type == 'sample_state'):
        return self.__update_sample_state(trans, sample, sample_id, **payload)
    elif (update_type == 'sample_dataset_transfer_status'):
        return self.__update_sample_dataset_status(trans, **payload)
