# Journal R API @blueprint.route('/journals/<journal_id>', methods=['GET']) @api_key_optional @swag(swag_summary='Retrieve a journal by ID', swag_spec=JournalsCrudApi.retrieve_swag()) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. def retrieve_journal(journal_id): return jsonify_data_object(JournalsCrudApi.retrieve(journal_id, current_user)) ######################################### # Application Bulk API @blueprint.route("/bulk/applications", methods=["POST"]) @api_key_required @write_required(api=True) @swag(swag_summary='Create applications in bulk <span class="red">[Authenticated, not public]</span>', swag_spec=ApplicationsBulkApi.create_swag()) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. def bulk_application_create(): # get the data from the request try: data = json.loads(request.data) except: raise Api400Error("Supplied data was not valid JSON") # 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)))
@blueprint.route('/journals/<journal_id>', methods=['GET']) @api_key_optional @swag(swag_summary='Retrieve a journal by ID', swag_spec=JournalsCrudApi.retrieve_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('retrieve_journal', 'Retrieve journal'), record_value_of_which_arg='journal_id') def retrieve_journal(journal_id): return jsonify_data_object(JournalsCrudApi.retrieve(journal_id, current_user)) ######################################### # Application Bulk API @blueprint.route("/bulk/applications", methods=["POST"]) @api_key_required @write_required(api=True) @swag(swag_summary='Create applications in bulk <span class="red">[Authenticated, not public]</span>', swag_spec=ApplicationsBulkApi.create_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_create', 'Bulk application create')) def bulk_application_create(): # get the data from the request try: data = json.loads(request.data.decode("utf-8")) except: raise Api400Error("Supplied data was not valid JSON") # 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)))
def retrieve_journal(journal_id): return jsonify_data_object( JournalsCrudApi.retrieve(journal_id, current_user)) ######################################### # Application Bulk API @blueprint.route("/bulk/applications", methods=["POST"]) @api_key_required @write_required(api=True) @swag( swag_summary= 'Create applications in bulk <span class="red">[Authenticated, not public]</span>', swag_spec=ApplicationsBulkApi.create_swag() ) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. def bulk_application_create(): # get the data from the request try: data = json.loads(request.data) except: raise Api400Error("Supplied data was not valid JSON") # delegate to the API implementation ids = ApplicationsBulkApi.create(data, current_user) # get all the locations for the ids inl = [] for id in ids: inl.append(