MCPcopy Create free account
hub / github.com/alephdata/aleph / create

Function create

aleph/views/collections_api.py:48–76  ·  view source on GitHub ↗

--- post: summary: Create a collection description: Create a collection with the given metadata requestBody: content: application/json: schema: $ref: '#/components/schemas/CollectionCreate' tags: - Collection

()

Source from the content-addressed store, hash-verified

46
47@blueprint.route("", methods=["POST", "PUT"])
48def create():
49 """
50 ---
51 post:
52 summary: Create a collection
53 description: Create a collection with the given metadata
54 requestBody:
55 content:
56 application/json:
57 schema:
58 $ref: '#/components/schemas/CollectionCreate'
59 tags:
60 - Collection
61 responses:
62 '200':
63 description: OK
64 content:
65 application/json:
66 schema:
67 $ref: '#/components/schemas/Collection'
68 """
69 require(request.authz.session_write)
70 data = parse_request("CollectionCreate")
71 sync = get_flag("sync", True)
72 try:
73 collection = create_collection(data, request.authz, sync=sync)
74 except ValueError:
75 raise BadRequest()
76 return view(collection.get("id"))
77
78
79@blueprint.route("/<int:collection_id>", methods=["GET"])

Callers

nothing calls this directly

Calls 6

requireFunction · 0.90
parse_requestFunction · 0.90
get_flagFunction · 0.90
create_collectionFunction · 0.90
viewFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected