Skip to content

Commit

Permalink
docs(filemanager): update API guide with multi-key querying
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalenic committed Oct 8, 2024
1 parent f96d4c9 commit 2c8f931
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/workload/stateless/stacks/filemanager/docs/API_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,27 @@ curl --get -H "Authorization: Bearer $TOKEN" --data-urlencode "attributes[portal
"https://file.dev.umccr.org/api/v1/s3" | jq
```

## Multiple keys

The API supports querying using multiple keys with the same name. This represents an `or` condition in the SQL query, where
records are fetched if any of the keys match. For example, the following finds records where the bucket is either `bucket1`
or `bucket2`:

```sh
curl -H "Authorization: Bearer $TOKEN" "https://file.dev.umccr.org/api/v1/s3?bucket[]=bucket1&bucket[]=bucket2" | jq
```

Note that the extra `[]` is required in the query parameters to specify multiple keys with the same name. Multiple keys
are also supported on attributes. For example, the following finds records where the `portalRunId` is either `20240521aecb782`
or `20240521aecb783`:

```sh
curl --get -H "Authorization: Bearer $TOKEN" \
--data-urlencode "attributes[portalRunId][]=20240521aecb782" \
--data-urlencode "attributes[portalRunId][]=20240521aecb783" \
"https://file.dev.umccr.org/api/v1/s3" | jq
```

## Updating records

As part of allowing filemanager to link and query on attributes, attributes can be updated using PATCH requests.
Expand Down Expand Up @@ -202,7 +223,7 @@ curl -H "Authorization: Bearer $TOKEN" "https://file.dev.umccr.org/api/v1/s3/pre
There are some missing features in the query API which are planned, namely:

* There is no way to compare values with `>`, `>=`, `<`, `<=`.
* There is no way to express `and` or `or` conditions in the API.
* There is no way to express `and` or `or` conditions in the API (except for multiple keys representing `or` conditions).

There are also some feature missing for attribute linking. For example, there is no way
to capture matching wildcard groups which can later be used in the JSON patch body.
Expand Down

0 comments on commit 2c8f931

Please sign in to comment.