Reference: Assistance with Backend Lab7 Queries Primer
This document is intended to serve as a short overview of how lab7.sample.sample_api.query_samples()` works.
There are a few things required by almost every backend module:
session
andagent
From
l7 console
agent
is known asadmin
For the
query
style endpoints, there are two main options:filters
- where users would search for a value (resource_vals
), like the value ofname
oruuid
params
- where users would start to select specific variables (resource_vars
), like the variable ofname
oruuid
The front-end api (at
/main/static/util.html
) has a good list of filters and params for each endpoint that should be the same on the backend (see example below)
return_dict=False
is a recommended option as it returns the result as an object rather than a dictionaryThis has some efficiency considerations on the SQL Alchemy side of things, so it's almost always better to use an object
Users could return specific params (it will return the minimum amount of things that it can), see example below: