Skip to content

Commit

Permalink
Remove by-id endpoints and rename by-refcode to simply `/items/<r…
Browse files Browse the repository at this point in the history
…efcode>`
  • Loading branch information
ml-evs committed Jul 31, 2024
1 parent 6a6153d commit 8828987
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 2 additions & 3 deletions pydatalab/pydatalab/routes/v0_1/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,13 @@ def delete_sample():
)


@ITEMS.route("/items/by-refcode/<refcode>", methods=["GET"])
@ITEMS.route("/items/by-id/<item_id>", methods=["GET"])
@ITEMS.route("/items/<refcode>", methods=["GET"])
@ITEMS.route("/get-item-data/<item_id>", methods=["GET"])
def get_item_data(
item_id: str | None = None, refcode: str | None = None, load_blocks: bool = False
):
"""Generates a JSON response for the item with the given `item_id`,
additionally resolving relationships to files and other items.
or `refcode` additionally resolving relationships to files and other items.
Parameters:
load_blocks: Whether to regenerate any data blocks associated with this
Expand Down
8 changes: 2 additions & 6 deletions pydatalab/tests/server/test_items.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
def test_single_item_endpoints(client, inserted_default_items):
for item in inserted_default_items:
response = client.get(f"/items/by-refcode/{item.refcode}")
response = client.get(f"/items/{item.refcode}")
assert response.status_code == 200, response.json
assert response.json["status"] == "success"

test_ref = item.refcode.split(":")[1]
response = client.get(f"/items/by-refcode/{test_ref}")
assert response.status_code == 200, response.json
assert response.json["status"] == "success"

response = client.get(f"/items/by-id/{item.item_id}")
response = client.get(f"/items/{test_ref}")
assert response.status_code == 200, response.json
assert response.json["status"] == "success"

Expand Down

0 comments on commit 8828987

Please sign in to comment.