Skip to content

GET deletes by identity, not required params #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lightbeam/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self, lightbeam=None):
self.lightbeam = lightbeam
self.logger = self.lightbeam.logger
self.config = None
self.reports_identity = False

# prepares this API object by fetching some of its metadata and
# setting up data and objects for further use
Expand Down Expand Up @@ -239,6 +240,8 @@ def load_swagger_docs(self):
if not response.ok:
raise Exception("OpenAPI metadata URL returned status {0} ({1})".format(response.status_code, (response.content[:75] + "...") if len(response.content)>75 else response.content))
swagger = response.json()
if '"x-Ed-Fi-isIdentity":' in response.text:
self.reports_identity = True

except Exception as e:
self.logger.critical(f"Unable to load {endpoint_type} Swagger from API... terminating. Check API connectivity.")
Expand Down
6 changes: 4 additions & 2 deletions lightbeam/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ async def do_deletes(self, endpoint):
tasks = []

# determine the fields that uniquely define a record for this endpoint
params_structure = self.lightbeam.api.get_params_for_endpoint(endpoint)

interpolation_type = 'required'
if self.lightbeam.api.reports_identity: interpolation_type = 'identity'
params_structure = self.lightbeam.api.get_params_for_endpoint(endpoint, type=interpolation_type)

# for Descriptors, we need to fetch all Descriptor values first, then we can look up the ID for deletion
if endpoint.endswith('Descriptors'):
self.logger.info("fetching current descriptors from endpoint {0} ...".format(endpoint))
Expand Down