def create_items(portal_type=None, uid=None, endpoint=None, **kw):
<EOL>req.disable_csrf_protection()<EOL>container = uid and get_object_by_uid(uid) or None<EOL>records = req.get_request_data()<EOL>results = []<EOL>for record in records:<EOL><INDENT>if portal_type is None:<EOL><INDENT>portal_type = record.pop("<STR_LIT>", None)<EOL><DEDENT>if not is_creation_allowed(portal_type):<EOL><INDENT>fail(<NUM_LIT>, "<STR_LIT>".format(portal_type))<EOL><DEDENT>if container is None:<EOL><INDENT>container = find_target_container(portal_type, record)<EOL><DEDENT>if not all([container, portal_type]):<EOL><INDENT>fail(<NUM_LIT>, "<STR_LIT>")<EOL><DEDENT>obj = create_object(container, portal_type, **record)<EOL>results.append(obj)<EOL><DEDENT>if not results:<EOL><INDENT>fail(<NUM_LIT>, "<STR_LIT>")<EOL><DEDENT>return make_items_for(results, endpoint=endpoint)<EOL>
create items

    1. If the uid is given, get the object and create the content in there
       (assumed that it is folderish)
    2. If the uid is 0, the target folder is assumed the portal.
    3. If there is no uid given, the payload is checked for either a key
        - `parent_uid`  specifies the *uid* of the target folder
        - `parent_path` specifies the *physical path* of the target folder