Skip to main content

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 and agent

  • From l7 consoleagent is known as admin

  • For the query style endpoints, there are two main options:

    • filters - where users would search for a value (resource_vals), like the value of name or uuid

    • params- where users would start to select specific variables (resource_vars), like the variable of name or uuid

  • 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)

19904925915027-mceclip0.png
  • return_dict=False is a recommended option as it returns the result as an object rather than a dictionary

    • This 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:

19904930741651-mceclip1.png
19904952361491-mceclip2.png
image idm45011431247408