diff --git a/entity-api-spec.yaml b/entity-api-spec.yaml index 8b8d8cd6..c93413b8 100644 --- a/entity-api-spec.yaml +++ b/entity-api-spec.yaml @@ -2540,12 +2540,9 @@ paths: content: application/json: schema: - type: object - properties: - entities: - type: array - items: - $ref: '#/components/schemas/Dataset' + type: array + items: + $ref: '#/components/schemas/Dataset' responses: '202': description: request is being processed @@ -2553,9 +2550,8 @@ paths: application/json: schema: type: array - properties: - uuid: - type: string + items: + type: string description: The uuids of the entities being processed '500': description: Internal error @@ -2567,12 +2563,9 @@ paths: content: application/json: schema: - type: object - properties: - entities: - type: array - items: - $ref: '#/components/schemas/Upload' + type: array + items: + $ref: '#/components/schemas/Upload' responses: '202': description: request is being processed @@ -2580,9 +2573,8 @@ paths: application/json: schema: type: array - properties: - uuid: - type: string + items: + type: string description: The uuids of the entities being processed '500': description: Internal error diff --git a/src/app.py b/src/app.py index 0b1375a6..fc9b0419 100644 --- a/src/app.py +++ b/src/app.py @@ -4290,6 +4290,7 @@ def bulk_update_entities( if idx < len(entity_updates) - 1: time.sleep(throttle) + logger.info(f"bulk_update_entities() results: {results}") return results @@ -4316,6 +4317,17 @@ def update_datasets_uploads(entity_updates: list, token: str, entity_api_url: st # Shirey: With this use case we're not worried about a lot of concurrent calls to this endpoint (only one user, # Brendan, will be ever using it). Just start a thread on request and loop through the Datasets/Uploads to change # with a 5 second delay or so between them to allow some time for reindexing. +# +# Example call +# 1) pick Dataset entities to change by querying Neo4J... +# URL: http://18.205.215.12:7474/browser/ +# query: MATCH (e:Dataset {entity_type: 'Dataset'}) RETURN e.uuid, e.status, e.ingest_task, e.assigned_to_group_name LIMIT 100 +# +# curl --request PUT \ +# --url ${ENTITY_API}/datasets \ +# --header "Content-Type: application/json" \ +# --header "Authorization: Bearer ${TOKEN}" \ +# --data '[{"uuid":"6ce8d4515bc87213e787397c2b4d2f99", "assigned_to_group_name":"TMC - Cal Tech"}, {"uuid":"a44a78bfbe0e702cdc172707b6061a16", "assigned_to_group_name":"TMC - Cal Tech"}]' @app.route('/datasets', methods=['PUT']) @app.route('/uploads', methods=['PUT']) def entity_bulk_update(): @@ -4326,7 +4338,7 @@ def entity_bulk_update(): validate_token_if_auth_header_exists(request) require_json(request) - entities = request.get_json().get('entities') + entities = request.get_json() if entities is None or not isinstance(entities, list) or len(entities) == 0: bad_request_error("Request object field 'entities' is either missing, " "does not contain a list, or contains an empty list") @@ -4539,7 +4551,7 @@ def validate_user_update_privilege(entity, user_token): user_group_uuids = [d['uuid'] for d in user_write_groups] if entity.get('group_uuid') not in user_group_uuids and is_admin is False: forbidden_error(f"User does not have write privileges for this entity. " - f"Reach out to the help desk (help@hubmapconsortium.org) to request access to group: {entity['group_uuid']}.") + "Please reach out to the help desk (help@hubmapconsortium.org) to request access.") """