File tree Expand file tree Collapse file tree 2 files changed +2
-18
lines changed
Expand file tree Collapse file tree 2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ GET /api/resources/find-resources-in-batch?id=riscv-ubuntu-20.04-boot&resource_v
5353
5454- Each ` id ` parameter must have a corresponding ` resource_version ` parameter
5555- Use ` resource_version=None ` to retrieve all versions of a resource
56- - Returns 404 if any requested resource is missing
56+ - Returns a list of resources that were found even if not all requested resources were found.
57+ - Returns an empty list is no resources were found.
5758
5859### 2. Advanced Resource Search
5960
Original file line number Diff line number Diff line change @@ -80,23 +80,6 @@ def find_resources_in_batch(req: func.HttpRequest) -> func.HttpResponse:
8080 collection .find ({"$or" : queries }, RESOURCE_FIELDS )
8181 )
8282
83- # Check if any resources were found
84- if not resources :
85- return create_error_response (
86- 404 , "No requested resources were found"
87- )
88-
89- # Check if at least one instance of each requested ID is present
90- found_ids = {resource .get ("id" ) for resource in resources }
91- missing_ids = set (ids ) - found_ids
92-
93- if missing_ids :
94- return create_error_response (
95- 404 ,
96- "The following requested resources were not found: "
97- f"{ ', ' .join (missing_ids )} " ,
98- )
99-
10083 return func .HttpResponse (
10184 body = json .dumps (resources ),
10285 status_code = 200 ,
You can’t perform that action at this time.
0 commit comments