Skip to content

Commit

Permalink
Merge pull request #567 from sennetconsortium/maxsibilla/issue-565
Browse files Browse the repository at this point in the history
Modifying create_dataset endpoint to be navigated at by /publications
  • Loading branch information
maxsibilla authored Oct 22, 2024
2 parents 4e60068 + aa90fa6 commit 50353ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ selenium==3.141.0
PyYAML==6.0

# The commons package requires requests>=2.22.0
requests==2.32.0
requests==2.32.3

# Use the published package from PyPI as default
# Use the branch name of commons from github for testing new changes made in commons from different branch
# Default is main branch specified in docker-compose.development.yml if not set
# git+https://github.com/hubmapconsortium/commons.git@${COMMONS_BRANCH}#egg=hubmap-commons
hubmap-commons==2.1.17
hubmap-commons==2.1.18
atlas-consortia-commons==1.0.10

# For assay type rules
Expand Down
7 changes: 6 additions & 1 deletion src/routes/entity_CRUD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@


@entity_CRUD_blueprint.route('/datasets', methods=['POST'])
@entity_CRUD_blueprint.route('/publications', methods=['POST'])
def create_dataset():
if not request.is_json:
return Response("json request required", 400)

if request.path.lower() == '/datasets':
entity_type = "dataset"
elif request.path.lower() == '/publications':
entity_type = "publication"
try:
dataset_request = request.json
# Get the single Globus groups token for authorization
Expand All @@ -72,7 +77,7 @@ def create_dataset():
requested_group_uuid = auth_helper_instance.get_write_group_uuid(token, requested_group_uuid)
dataset_request['group_uuid'] = requested_group_uuid
post_url = commons_file_helper.ensureTrailingSlashURL(
current_app.config['ENTITY_WEBSERVICE_URL']) + 'entities/dataset'
current_app.config['ENTITY_WEBSERVICE_URL']) + f'entities/{entity_type}'
response = requests.post(post_url, json=dataset_request,
headers={'Authorization': 'Bearer ' + token, 'X-SenNet-Application': 'ingest-api'},
verify=False)
Expand Down

0 comments on commit 50353ca

Please sign in to comment.