Пример #1
0
    # delegate to the API implementation
    ids = ApplicationsBulkApi.create(data, current_user._get_current_object())

    # get all the locations for the ids
    inl = []
    for id in ids:
        inl.append((id, url_for("api_v1.retrieve_application", application_id=id)))

    # respond with a suitable Created response
    return bulk_created(inl)


@blueprint.route("/bulk/applications", methods=["DELETE"])
@api_key_required
@write_required(api=True)
@swag(swag_summary='Delete applications in bulk <span class="red">[Authenticated, not public]</span>', swag_spec=ApplicationsBulkApi.delete_swag())  # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes.
def bulk_application_delete():
    # get the data from the request
    try:
        data = json.loads(request.data)
    except:
        raise Api400Error("Supplied data was not valid JSON")

    ApplicationsBulkApi.delete(data, current_user._get_current_object())

    return no_content()


#########################################
# Article Bulk API
Пример #2
0
    # delegate to the API implementation
    ids = ApplicationsBulkApi.create(data, current_user._get_current_object())

    # get all the locations for the ids
    inl = []
    for id in ids:
        inl.append((id, url_for("api_v1.retrieve_application", application_id=id)))

    # respond with a suitable Created response
    return bulk_created(inl)


@blueprint.route("/bulk/applications", methods=["DELETE"])
@api_key_required
@write_required(api=True)
@swag(swag_summary='Delete applications in bulk <span class="red">[Authenticated, not public]</span>', swag_spec=ApplicationsBulkApi.delete_swag())  # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes.
@analytics.sends_ga_event(GA_CATEGORY, GA_ACTIONS.get('bulk_application_delete', 'Bulk application delete'))
def bulk_application_delete():
    # get the data from the request
    try:
        data = json.loads(request.data.decode("utf-8"))
    except:
        raise Api400Error("Supplied data was not valid JSON")

    ApplicationsBulkApi.delete(data, current_user._get_current_object())

    return no_content()


#########################################
# Article Bulk API
Пример #3
0
    inl = []
    for id in ids:
        inl.append(
            (id, url_for("api_v1.retrieve_application", application_id=id)))

    # respond with a suitable Created response
    return bulk_created(inl)


@blueprint.route("/bulk/applications", methods=["DELETE"])
@api_key_required
@write_required(api=True)
@swag(
    swag_summary=
    'Delete applications in bulk <span class="red">[Authenticated, not public]</span>',
    swag_spec=ApplicationsBulkApi.delete_swag()
)  # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes.
def bulk_application_delete():
    # get the data from the request
    try:
        data = json.loads(request.data)
    except:
        raise Api400Error("Supplied data was not valid JSON")

    ApplicationsBulkApi.delete(data, current_user)

    return no_content()


#########################################
# Article Bulk API