'create( trans, payload )
* POST /api/histories:
create a new history
:type   payload: dict
:param  payload: (optional) dictionary structure containing:
* name:             the new history\'s name
* history_id:       the id of the history to copy
* all_datasets:     copy deleted hdas/hdcas? \'True\' or \'False\', defaults to True
* archive_source:   the url that will generate the archive to import
* archive_type:     \'url\' (default)
:param  keys: same as the use of `keys` in the `index` function above
:param  view: same as the use of `view` in the `index` function above
:rtype:     dict
:returns:   element view of new history'

@expose_api_anonymous
def create(self, trans, payload, **kwd):

    hist_name = None
    if payload.get('name', None):
        hist_name = restore_text(payload['name'])
    copy_this_history_id = payload.get('history_id', None)
    all_datasets = util.string_as_bool(payload.get('all_datasets', True))
    if ('archive_source' in payload):
        archive_source = payload['archive_source']
        archive_type = payload.get('archive_type', 'url')
        self.queue_history_import(trans, archive_type=archive_type, archive_source=archive_source)
        return {}
    new_history = None
    if copy_this_history_id:
        decoded_id = self.decode_id(copy_this_history_id)
        original_history = self.history_manager.get_accessible(decoded_id, trans.user, current_history=trans.history)
        hist_name = (hist_name or ("Copy    of    '%s'" % original_history.name))
        new_history = original_history.copy(name=hist_name, target_user=trans.user, all_datasets=all_datasets)
    else:
        new_history = self.history_manager.create(user=trans.user, name=hist_name)
    trans.sa_session.add(new_history)
    trans.sa_session.flush()
    if self.user_manager.is_anonymous(trans.user):
        self.history_manager.set_current(trans, new_history)
    return self.history_serializer.serialize_to_view(new_history, user=trans.user, trans=trans, **self._parse_serialization_params(kwd, 'detailed'))
