Exemplo n.º 1
0
def bulk_create_event(user, org):
    """
    Create an event.
    """
    req_data = request_data()

    # check for valid format.
    if not isinstance(req_data, list):
        raise RequestError(
            "Non-bulk endpoints require a list of json objects.")

    job_id = load.events(req_data,
                         org_id=org.id,
                         org_domains=org.domains,
                         must_link=arg_bool('must_link', False),
                         recipe_id=arg_str('recipe_id', default=None),
                         queued=True)

    ret = url_for_job_status(apikey=user.apikey, job_id=job_id, queue='bulk')
    return jsonify(ret, status=202)
Exemplo n.º 2
0
def bulk_create_event(user, org):
    """
    Create an event.
    """
    req_data = request_data()

    # check for valid format.
    if not isinstance(req_data, list):
        raise RequestError(
            "Non-bulk endpoints require a list of json objects.")

    job_id = load.events(
        req_data,
        org_id=org.id,
        org_domains=org.domains,
        must_link=arg_bool('must_link', False),
        recipe_id=arg_str('recipe_id', default=None),
        queued=True)

    ret = url_for_job_status(apikey=user.apikey, job_id=job_id, queue='bulk')
    return jsonify(ret, status=202)
Exemplo n.º 3
0
def create_event(user, org):
    """
    Create an event.
    """
    req_data = request_data()

    # check for valid format.
    if not isinstance(req_data, dict):
        raise RequestError("Non-bulk endpoints require a single json object.")

    events = load.events(req_data,
                         org_id=org.id,
                         org_domains=org.domains,
                         must_link=arg_bool('must_link', False),
                         recipe_id=arg_str('recipe_id', default=None),
                         queued=False)

    if len(events) == 1:
        events = events[0]

    return jsonify(events)
Exemplo n.º 4
0
def create_event(user, org):
    """
    Create an event.
    """
    req_data = request_data()

    # check for valid format.
    if not isinstance(req_data, dict):
        raise RequestError(
            "Non-bulk endpoints require a single json object."
        )

    events = load.events(
        req_data,
        org_id=org.id,
        org_domains=org.domains,
        must_link=arg_bool('must_link', False),
        recipe_id=arg_str('recipe_id', default=None),
        queued=False)

    if len(events) == 1:
        events = events[0]

    return jsonify(events)